tar

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Extract

func Extract(reader io.Reader, options ExtractOptions) error

Extract extracts a tarball given as a reader interface.

func ExtractFile

func ExtractFile(fileName string, options ExtractOptions) error

ExtractFile extracts a tar file contents.

Types

type Compression

type Compression int

Compression is a compression flag.

const (
	NoCompression Compression = iota
	GzipCompression
)

type ExtractOptions

type ExtractOptions struct {
	// OutDir is a directory where to extract the files. Current working directory by default.
	OutDir string
	// Compression indicates is the tarball compressed or not.
	Compression Compression
	// StripComponents is like --strip-components of tar utility. It strips first N components from the path by a given depth.
	StripComponents uint
	// Files is a list of files to extract. If empty, extract all the files.
	Files []string
	// OutFiles is a resulting map passed by user. If non-nil then it will store the mapping from tar file names to file system paths.
	OutFiles map[string]string
}

ExtractOptions is the options for Extract and ExtractFile functions.

Jump to

Keyboard shortcuts

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