Documentation
¶
Overview ¶
Package archive contains the SDK for Zarf archival and compression.
Index ¶
- func Compress(ctx context.Context, sources []string, dest string, _ CompressOpts) (err error)
- func Decompress(ctx context.Context, source, dst string, opts DecompressOpts) error
- func DecompressStream(ctx context.Context, src io.Reader, dst string, opts DecompressOpts) error
- type CompressOpts
- type DecompressOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compress ¶
Compress archives the given sources into dest, selecting the format by dest's extension.
func Decompress ¶
func Decompress(ctx context.Context, source, dst string, opts DecompressOpts) error
Decompress extracts source into dst, using strip or filter logic, then optionally nests. If opts.Extractor is nil the archive format is detected from source's file extension.
func DecompressStream ¶ added in v0.81.0
DecompressStream extracts an archive read from src into dst. Because the archive format cannot be detected from a stream, opts.Extractor is required. The extractor must support sequential reads from a non-seekable stream. Formats that require random access to the whole archive (e.g. zip) will error unless src also implements io.ReaderAt and io.Seeker.
Types ¶
type CompressOpts ¶
type CompressOpts struct{}
CompressOpts holds future optional parameters for Compress.
type DecompressOpts ¶
type DecompressOpts struct {
// UnarchiveAll enables recursive unpacking of nested .tar files.
UnarchiveAll bool
// Files restricts extraction to these archive paths if non-empty.
Files []string
// StripComponents drops leading path elements from each entry.
StripComponents int
// OverwriteExisting truncates existing files instead of erroring.
OverwriteExisting bool
// SkipValidation suppresses errors for missing Files entries.
SkipValidation bool
// Extractor allows the user to specify which extractor should be used for decompression.
// If this is not set it will be determined automatically from the file extension
Extractor archives.Extractor
}
DecompressOpts defines optional behavior for Decompress.