Documentation ¶
Index ¶
- type Archive
- func (a *Archive) AddEntry(path, name string, info os.FileInfo) error
- func (a *Archive) ArchivePath(paths ...string) error
- func (a *Archive) Close() error
- func (a *Archive) Extract(base string, opts *ExtractOptions) error
- func (a *Archive) LimitArchive(limit int64) *Archive
- func (a *Archive) LimitData(limit int64) *Archive
- func (a *Archive) SetupReader() error
- func (a *Archive) SetupWriter() error
- func (a *Archive) WithReader(r io.Reader) *Archive
- func (a *Archive) WithWriter(w io.Writer) *Archive
- type Compressor
- type ExtractOptions
- type ExtractionAbortedError
- type LimitWriter
- type ReadLimitExceeded
- type Type
- type WriteLimitExceeded
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Archive ¶
type Archive struct { Type Type // Type specifies the archive type. Compressor Compressor // Compressor specifies the compressor to use. Writer io.Writer // Writer provides sequential writing of an archive. Reader io.Reader // Reader provides sequential reading of an archive. ReadLimit int64 // ReadLimit allows to limit the data read. WriteLimit int64 // WriteLimit allows to limit the data written, i.e., the archive size. // contains filtered or unexported fields }
Archive provides access to an archive.
func NewTarGz ¶
func NewTarGz() *Archive
NewTarGz returns a pointer to a new Tar+Gzip archive structure.
func (*Archive) ArchivePath ¶
ArchivePath archives the given path.
func (*Archive) Extract ¶
func (a *Archive) Extract(base string, opts *ExtractOptions) error
Extract extracts an archive to a given path according to the given rules.
func (*Archive) LimitArchive ¶
LimitArchive sets the maximum size an archive may grow to.
func (*Archive) SetupReader ¶
SetupReader initializes resources used needed for reading an archive.
func (*Archive) SetupWriter ¶
SetupWriter initializes resources needed for creating an archive.
func (*Archive) WithReader ¶
WithWriter sets the backing reader.
type Compressor ¶
type Compressor int
Compressor represents the compression type.
const ( CompressorNone Compressor = iota // CompressNone disables compression. CompressorGzip // CompressGzip represents the Gzip compressor. )
Constants to identify compression type.
type ExtractOptions ¶
type ExtractOptions struct { Verbose bool Overwrite bool Interactive bool RestoreOwner bool RestoreTimestamps bool FailOnError bool ShowErrors bool Stdout io.Writer Stderr io.Writer Errors []error }
ExtractOptions specifies how an archive is to be extracted.
func NewExtractOptions ¶
func NewExtractOptions() *ExtractOptions
NewExtractOptions returns an pointer to an ExtractOptions structure initialized with defaults values.
type ExtractionAbortedError ¶
type ExtractionAbortedError struct{}
func (ExtractionAbortedError) Error ¶
func (e ExtractionAbortedError) Error() string
type LimitWriter ¶
LimitWriter wraps a Writer and returns an error if the written data exceeds a given limit.
func NewLimitWriter ¶
func NewLimitWriter(w io.Writer, limit int64) *LimitWriter
NewLimitWriter returns a pointer to a new LimitWriter wrapping a Writer and limiting written data to the given size.
type ReadLimitExceeded ¶
type ReadLimitExceeded struct{}
ReadLimitExceeded is an error object returned when a read would exceed a set limit.
func (ReadLimitExceeded) Error ¶
func (ReadLimitExceeded) Error() string
type WriteLimitExceeded ¶
type WriteLimitExceeded struct{}
WriteLimitExceeded is an error object returned when a write would exceed a set limit.
func (WriteLimitExceeded) Error ¶
func (WriteLimitExceeded) Error() string