archive

package
v0.81.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package archive contains the SDK for Zarf archival and compression.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(ctx context.Context, sources []string, dest string, _ CompressOpts) (err error)

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

func DecompressStream(ctx context.Context, src io.Reader, dst string, opts DecompressOpts) error

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.

Jump to

Keyboard shortcuts

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