archive

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package archive provides archive creation and manipulation functionality.

Index

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

func CreateTarZst(ctx context.Context, sourceDir, outputFile string, formatGNU bool) error

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

func Extract(ctx context.Context, source, destination string) error

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

func ExtractFiltered(ctx context.Context, source, destination string, patterns []string) error

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.

Jump to

Keyboard shortcuts

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