zip

package
v0.169.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Extract added in v0.133.0

func Extract(targetDir string, file *zip.File) error

Types

type Writer

type Writer struct {
	W       *zip.Writer
	M       sauceignore.Matcher
	ZipFile *os.File
}

Writer is a wrapper around zip.Writer and implements zip archiving for archive.Writer.

func New added in v0.47.0

func New(f io.Writer, matcher sauceignore.Matcher) (Writer, error)

New returns a new Writer that archives files to the specified io.Writer.

func NewFileWriter added in v0.47.0

func NewFileWriter(name string, matcher sauceignore.Matcher) (Writer, error)

NewFileWriter returns a new Writer that archives files to name.

func (*Writer) Add

func (w *Writer) Add(src, dst string) (count int, length int, err error)

Add adds the file at src to the destination dst in the archive and returns a count of the files added to the archive, as well the length of the longest path. The added file names should not contain any backslashes according to the specification outlined in https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT. It's essential to adhere to this specification to ensure compatibility and proper functioning of the files across different systems and platforms.

func (*Writer) Close

func (w *Writer) Close() error

Close closes the archive. Adding more files to the archive is not possible after this.

Jump to

Keyboard shortcuts

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