archive

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package archive contains functionality for archiving/unarchiving streams.

Index

Constants

View Source
const (
	Uncompressed = Compression(archive.Uncompressed) // Uncompressed represents the uncompressed.
	Bzip2        = Compression(archive.Bzip2)        // Bzip2 is bzip2 compression algorithm.
	Gzip         = Compression(archive.Gzip)         // Gzip is gzip compression algorithm.
	Xz           = Compression(archive.Xz)           // Xz is xz compression algorithm.
	Zstd         = Compression(archive.Zstd)         // Zstd is zstd compression algorithm.
)

Compressions types.

Variables

This section is empty.

Functions

func Tar

func Tar(src CopyInfo, dst CopyInfo, opts *TarOptions) (io.ReadCloser, error)

Tar creates an archive from the source.

func Untar

func Untar(content io.ReadCloser, dstPath string, opts *TarOptions) error

Untar reads a stream of bytes from `archive`, parses it as a tar archive, and unpacks it into the directory at `dest`. The archive may be compressed with one of the following algorithms: identity (uncompressed), gzip, bzip2, xz.

Types

type ChownOpts added in v0.22.0

type ChownOpts archive.ChownOpts

ChownOpts has ownership of files in the archive.

type Compression

type Compression compression.Compression

Compression is the state represents if compressed or not.

type CopyInfo

type CopyInfo archive.CopyInfo

CopyInfo holds basic info about the source or destination path of a copy operation.

func CopyInfoSourcePath

func CopyInfoSourcePath(path string, followLink bool) (CopyInfo, error)

CopyInfoSourcePath stats the given path to create a CopyInfo struct representing that resource for the source of an archive copy operation. The given path should be an absolute local path.

type TarOptions

type TarOptions struct {
	IncludeFiles    []string
	ExcludePatterns []string
	Compression     Compression
	RebaseNames     map[string]string
	SrcInfo         CopyInfo
	ChownOpts       *ChownOpts
}

TarOptions wraps the tar options.

Jump to

Keyboard shortcuts

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