Documentation ¶
Index ¶
- type CompressionType
- type Tar
- func (t *Tar) ForEach(cb func(header *tar.Header, reader io.Reader) error) error
- func (t *Tar) GetReader() *tar.Reader
- func (t *Tar) Load(in io.Reader) (int64, error)
- func (t *Tar) Save(out io.Writer) (int64, error)
- func (t *Tar) ToData() ([]byte, error)
- func (t *Tar) ToDirectory(path string) error
- func (t *Tar) ToFile(path string) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompressionType ¶
type CompressionType int
CompressionType specifies the compression. Valid values: NO_COMPRESSION, GZIP, BZIP2, LZMA
const ( NO_COMPRESSION CompressionType = iota GZIP BZIP2 LZMA )
func GuessCompression ¶
func GuessCompression(name string) CompressionType
GuessCompression guesses the compression type by fileextension
type Tar ¶
type Tar struct { Data []byte Compression CompressionType }
Tar contains the uncompressed tar data and the desired Compression This is the main struct of this packet
func NewFromData ¶
func NewFromData(data []byte, compression CompressionType) (*Tar, error)
NewFromData loades a datablob with the specified compression
func NewFromDirectory ¶
NewFromDirectory creates a tar archive from the contents (!) of the given directory
func NewFromFile ¶
NewFromFile loades a tar from a file. CompressionType is guessed by fileextension
func (*Tar) ForEach ¶
ForEach iterates over the tars contents, and calls the given callback for each entity (directories and files)
func (*Tar) ToDirectory ¶
ToDirectory extracts the tars contents into the given directory