zip

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorDuplicateZipPath added in v0.4.0

func ErrorDuplicateZipPath(path string) error

func ToFile

func ToFile(zipInput *Input, destPath string) error

func ToMem

func ToMem(zipInput *Input) ([]byte, error)

func ToWriter

func ToWriter(zipInput *Input, writer io.Writer) error

func UnzipFileToMem

func UnzipFileToMem(src string) (map[string][]byte, error)

func UnzipMemToMem

func UnzipMemToMem(zipBytes []byte) (map[string][]byte, error)

func UnzipToFile

func UnzipToFile(src string, destPath string) ([]string, error)

func UnzipToMem

func UnzipToMem(r *zip.Reader) (map[string][]byte, error)

Types

type BytesInput

type BytesInput struct {
	Content []byte
	Dest    string
}

type DirInput

type DirInput struct {
	Source             string
	Dest               string
	IgnoreFns          []files.IgnoreFn
	Flatten            bool
	RemovePrefix       string
	RemoveCommonPrefix bool
}

type Error added in v0.4.0

type Error struct {
	Kind ErrorKind
	// contains filtered or unexported fields
}

func (Error) Error added in v0.4.0

func (e Error) Error() string

type ErrorKind added in v0.4.0

type ErrorKind int
const (
	ErrUnknown ErrorKind = iota
	ErrDuplicateZipPath
)

func (ErrorKind) MarshalBinary added in v0.4.0

func (t ErrorKind) MarshalBinary() ([]byte, error)

MarshalBinary satisfies BinaryMarshaler

func (ErrorKind) MarshalText added in v0.4.0

func (t ErrorKind) MarshalText() ([]byte, error)

MarshalText satisfies TextMarshaler

func (ErrorKind) String added in v0.4.0

func (t ErrorKind) String() string

func (*ErrorKind) UnmarshalBinary added in v0.4.0

func (t *ErrorKind) UnmarshalBinary(data []byte) error

UnmarshalBinary satisfies BinaryUnmarshaler Needed for msgpack

func (*ErrorKind) UnmarshalText added in v0.4.0

func (t *ErrorKind) UnmarshalText(text []byte) error

UnmarshalText satisfies TextUnmarshaler

type FileInput

type FileInput struct {
	Source string
	Dest   string
}

type FileListInput

type FileListInput struct {
	Sources            []string
	Dest               string
	Flatten            bool
	RemovePrefix       string
	RemoveCommonPrefix bool
}

type Input

type Input struct {
	Files          []FileInput
	Bytes          []BytesInput
	Dirs           []DirInput
	FileLists      []FileListInput
	AddPrefix      string   // Gets added to every item
	EmptyFiles     []string // Empty files to be created
	AllowOverwrite bool     // Don't error if a file in the zip is overwritten
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL