tarball

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Walk

func Walk(tarstream io.Reader, walkFunc WalkFunc) error

Walk walks through the files in the tarball represented by tarstream and passes each of them to the WalkFunc provided as an argument

Types

type TarFile

type TarFile struct {
	Header *tar.Header
	Stream io.Reader
}

TarFile is a representation of a file in a tarball. It consists of two parts, the Header and the Stream. The Header is a regular tar header, the Stream is a byte stream that can be used to read the file's contents

func (*TarFile) Name

func (t *TarFile) Name() string

Name returns the name of the file as reported by the header

func (*TarFile) NameParts

func (t *TarFile) NameParts() []string

NameParts returns an array of the parts of the file's name, split by os.PathSeparator

type Tarstream

type Tarstream interface {
	// Close closes the underlying tar writer
	Close() error

	// Add adds tf to the underlying tar writer. First, the header is written.
	// Then, if tf.Stream is not nil, its contents are copied into underlying
	// tar writer
	Add(tf *TarFile) error
}

Tarstream is a type for writing tarballs

func NewTarstream

func NewTarstream(outstream io.Writer) Tarstream

NewTarstream returns a tar stream that wries Add()'ed files to outstream

type WalkFunc

type WalkFunc func(t *TarFile) error

WalkFunc is a func for handling each file (header and byte stream) in a tarball

Jump to

Keyboard shortcuts

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