rzip

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFromDirectory

func CreateFromDirectory(source string, buf *os.File, onZip OnZipFn, opts ...CreateOption) error

CreateFromDirectory creates a zip archive from the given directory recursively, that is suitable for transporting across machines.

It resolves any symlinks it encounters.

An optional function callback onZip can be passed to observe files being included, or simply to exclude files. Additional behavior (e.g. flagging executable entries) can be configured via CreateOption values.

func ExtractTarGzToDirectory

func ExtractTarGzToDirectory(artifactPath string, targetDirectory string) error

ExtractTarGzToDirectory extracts a .tar.gz archive to the specified target directory

func ExtractToDirectory

func ExtractToDirectory(artifactPath string, targetDirectory string) error

Types

type CreateOption added in v1.26.0

type CreateOption func(*createOptions)

CreateOption configures optional behavior of CreateFromDirectory.

func WithExecutableMatcher added in v1.26.0

func WithExecutableMatcher(fn ExecutableMatcherFn) CreateOption

WithExecutableMatcher registers a predicate used to flag regular-file entries that must be marked executable (Unix mode +x) in the resulting zip. See ExecutableMatcherFn for details.

type ExecutableMatcherFn added in v1.26.0

type ExecutableMatcherFn func(src string, info os.FileInfo) bool

ExecutableMatcherFn is a predicate invoked for each regular file added to the archive. When it returns true, the file's zip entry is marked executable (the Unix execute bits are OR'd into its mode).

This exists primarily for Windows, whose filesystem does not track Unix execute bits: a compiled binary (e.g. the Azure Functions Go worker) would otherwise lose its +x permission when the zip is extracted on Linux. Callers that produce such binaries can flag exactly those entries instead of relying on a blunt heuristic.

type OnZipFn

type OnZipFn func(src string, info os.FileInfo) (bool, error)

OnZipFn is a function that is invoked on each file or directory, returning a bool to indicate whether the entry should be included in the final zip.

Jump to

Keyboard shortcuts

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