tar

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultExclusionPattern = regexp.MustCompile("((^\\.git\\/)|(\\/.git\\/)|(\\/.git$))")

DefaultExclusionPattern is the pattern of files that will not be included in a tar file when creating one. By default it is any file inside a .git metadata directory

Functions

This section is empty.

Types

type Tar

type Tar interface {
	// SetExclusionPattern sets the exclusion pattern for tar
	// creation
	SetExclusionPattern(*regexp.Regexp)

	// CreateTarFile creates a tar file in the base directory
	// using the contents of dir directory
	// The name of the new tar file is returned if successful
	CreateTarFile(base, dir string) (string, error)

	// CreateTarStreamWithLogging creates a tar from the given directory
	// and streams it to the given writer.
	// An error is returned if an error occurs during streaming.
	// Archived file names are written to the logger if provided
	CreateTarStreamWithLogging(dir string, includeDirInPath bool, writer io.Writer, logger io.Writer) error

	// CreateTarStream creates a tar from the given directory
	// and streams it to the given writer.
	// An error is returned if an error occurs during streaming.
	CreateTarStream(dir string, includeDirInPath bool, writer io.Writer) error

	// ExtractTarStream extracts files from a given tar stream.
	// Times out if reading from the stream for any given file
	// exceeds the value of timeout
	ExtractTarStream(dir string, reader io.Reader) error

	// ExtractTarStreamWithLogging extracts files from a given tar stream.
	// Times out if reading from the stream for any given file
	// exceeds the value of timeout.
	// Extracted file names are written to the logger if provided.
	ExtractTarStreamWithLogging(dir string, reader io.Reader, logger io.Writer) error

	// StreamFileAsTar streams a single file as a TAR archive into specified
	// writer. The second argument is the file name in archive.
	// The file permissions in tar archive will change to 0666.
	StreamFileAsTar(string, string, io.Writer) error

	// StreamFileAsTarWithCallback streams a single file as a TAR archive into specified
	// writer. By specifying walkFn you can modify file's permissions in arbitrary way.
	// If modifyInplace is set to false, file will be copied into a temporary directory before changing its permissions.
	StreamFileAsTarWithCallback(source, name string, writer io.Writer, walkFn filepath.WalkFunc, modifyInplace bool) error

	// StreamDirAsTar streams a directory as a TAR archive into specified writer.
	// The second argument is the name of the folder in the archive.
	// All files in the source folder will have permissions changed to 0666 in the
	// tar archive.
	StreamDirAsTar(string, string, io.Writer) error

	// StreamDirAsTarWithCallback streams a directory as a TAR archive into specified writer.
	// By specifying walkFn you can modify files' permissions in arbitrary way.
	// If modifyInplace is set to false, all the files will be copied into a temporary directory before changing their permissions.
	StreamDirAsTarWithCallback(source string, writer io.Writer, walkFn filepath.WalkFunc, modifyInplace bool) error
}

Tar can create and extract tar files used in an STI build

func New

func New() Tar

New creates a new Tar

Jump to

Keyboard shortcuts

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