Documentation
¶
Index ¶
- func CreateFromDirectory(source string, buf *os.File, onZip OnZipFn, opts ...CreateOption) error
- func ExtractTarGzToDirectory(artifactPath string, targetDirectory string) error
- func ExtractToDirectory(artifactPath string, targetDirectory string) error
- type CreateOption
- type ExecutableMatcherFn
- type OnZipFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFromDirectory ¶
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 ¶
ExtractTarGzToDirectory extracts a .tar.gz archive to the specified target directory
func ExtractToDirectory ¶
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
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.