tar

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package tar contains helper functions for working with tar files

Index

Constants

View Source
const DEFAULT_DIR_MODE os.FileMode = 0755

Variables

View Source
var ErrNotSupportedPlatform = errors.New("platform and architecture is not supported")

Functions

func ExtractFile added in v0.2.0

func ExtractFile(tr *tar.Reader, hdr *tar.Header, dir string, overwrite bool) error

ExtractFile extracts the file described by hdr from the given tarball into the provided directory. If overwrite is true, existing files will be overwritten.

func ExtractFileFromTar added in v0.2.0

func ExtractFileFromTar(tr *tar.Reader, file string) ([]byte, error)

ExtractFileFromTar extracts a regular file from the given tar, returning its contents as a byte slice

func ExtractTar

func ExtractTar(tr *tar.Reader, dir string, overwrite bool, pwl PathWhitelistMap) error

ExtractTar extracts a tarball (from a tar.Reader) into the given directory if pwl is not nil, only the paths in the map are extracted. If overwrite is true, existing files will be overwritten.

func HdrToTimespec added in v0.4.2

func HdrToTimespec(hdr *tar.Header) []syscall.Timespec

func LUtimesNano added in v0.4.2

func LUtimesNano(path string, ts []syscall.Timespec) error

Types

type PathWhitelistMap added in v0.2.0

type PathWhitelistMap map[string]struct{}

Map of paths that should be whitelisted. The paths should be relative to the root of the tar file and should be cleaned (for example using filepath.Clean)

Jump to

Keyboard shortcuts

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