zipz

package
v0.0.62 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDoNotUnzipAFileAtRiskOfZipSlip = errors.New("zipz: do not unzip a file at risk of zip slip")

Functions

func AddFileToZip added in v0.0.52

func AddFileToZip(dstZipFile string, entryName string, src io.Reader, opts ...AddFileToZipOption) error

AddFileToZip is a function to add a file to an existing zip file.

For Decompression Bomb protection, files larger than the size limit will cause an error using io.LimitReader. If a value less than or equal to 0 is specified for decompressionBombLimit, no Decompression Bomb protection will be performed.

func UnzipFile

func UnzipFile(srcZipFilePath, dstDir string, opts ...UnzipFileOption) (paths []string, err error)

func ZipDir

func ZipDir(dst io.Writer, srcDir string, opts ...ZipDirOption) error

Types

type AddFileToZipOption added in v0.0.52

type AddFileToZipOption interface {
	// contains filtered or unexported methods
}

func WithAddFileToZipOptionDecompressionBombLimit added in v0.0.57

func WithAddFileToZipOptionDecompressionBombLimit(decompressionBombLimit int64) AddFileToZipOption

type UnzipFileOption

type UnzipFileOption interface {
	// contains filtered or unexported methods
}

func WithUnzipFileOptionFileInZipHandler added in v0.0.57

func WithUnzipFileOptionFileInZipHandler(f func(zipfile *zip.File, dstDir string) error) UnzipFileOption

type ZipDirOption

type ZipDirOption interface {
	// contains filtered or unexported methods
}

func WithZipDirOptionPathInZipHandlerFunc added in v0.0.57

func WithZipDirOptionPathInZipHandlerFunc(f func(path string) string) ZipDirOption

WithZipDirOptionPathInZipHandlerFunc is a function to specify the path in the zip file.

func WithZipDirOptionWalkFunc added in v0.0.57

func WithZipDirOptionWalkFunc(f func(path string, info os.FileInfo, err error) error) ZipDirOption

Jump to

Keyboard shortcuts

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