Documentation
¶
Overview ¶
Package archive provides archive creation and manipulation functionality.
Index ¶
- func CreateTarCompressed(ctx context.Context, sourceDir, outputFile, compression string, formatGNU bool) error
- func CreateTarZst(ctx context.Context, sourceDir, outputFile string, formatGNU bool) error
- func Extract(ctx context.Context, source, destination string) error
- func ExtractFiltered(ctx context.Context, source, destination string, patterns []string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTarCompressed ¶
func CreateTarCompressed( ctx context.Context, sourceDir, outputFile, compression string, formatGNU bool, ) error
CreateTarCompressed creates a compressed tar archive with the specified compression algorithm from the source directory. Supported compression algorithms are "zstd", "gzip", and "xz". If compression is empty, defaults to "zstd". Returns an error if the compression algorithm is unsupported.
func CreateTarZst ¶
CreateTarZst creates a compressed tar.zst archive from the specified source directory. This is a convenience wrapper around CreateTarCompressed that defaults to zstd compression.
func Extract ¶
Extract extracts an archive file to the specified destination directory. It opens the source archive file, identifies its format, and extracts it to the destination.
Returns an error if there was a problem extracting the files.
func ExtractFiltered ¶
ExtractFiltered extracts an archive file to the destination directory, only including entries whose NameInArchive matches at least one of the provided glob patterns (using filepath.Match semantics). If patterns is empty every entry is extracted (equivalent to Extract).
Types ¶
This section is empty.