Documentation ¶
Overview ¶
Package archiver provides archiving and extraction for caches and build artifacts.
Index ¶
- Variables
- func Has(format string) bool
- func Register(format string, archiver NewArchiverCallback, extractor NewExtractorCallback)
- type Archiver
- func NewArchiver(format string, w io.Writer, dir string, level CompressionLevel) (Archiver, error)
- func NewGzipArchiver(w io.Writer, dir string, level CompressionLevel) (Archiver, error)
- func NewRawArchiver(w io.Writer, dir string, level CompressionLevel) (Archiver, error)
- func NewZipArchiver(w io.Writer, dir string, level CompressionLevel) (Archiver, error)
- type CompressionLevel
- type Extractor
- type GzipArchiver
- type NewArchiverCallback
- type NewExtractorCallback
- type RawArchiver
- type ZipArchiver
- type ZipExtractor
Constants ¶
This section is empty.
Variables ¶
var ( // ErrArchiverNotFound is returned if an archiver or extractor format // requested has not been registered. ErrArchiverNotFound = errors.New("archiver not found") )
var ErrTooManyRawFiles = errors.New("only one file can be sent as raw")
ErrTooManyRawFiles is returned if more than one file is passed to the RawArchiver.
Functions ¶
func Register ¶
func Register(format string, archiver NewArchiverCallback, extractor NewExtractorCallback)
Register registers a new archiver.
Types ¶
type Archiver ¶
Archiver is an interface for the Archive method.
func NewArchiver ¶
NewArchiver returns a new Archiver of the specified format.
The archiver will ensure that files to be archived are children of the directory provided.
func NewGzipArchiver ¶
NewGzipArchiver returns a new GzipArchiver.
func NewRawArchiver ¶
NewRawArchiver returns a new RawArchiver.
func NewZipArchiver ¶
NewZipArchiver returns a new ZipArchiver.
type CompressionLevel ¶
type CompressionLevel int
CompressionLevel type for specifying a compression level.
const ( Fastest CompressionLevel = -2 Fast CompressionLevel = -1 Default CompressionLevel = 0 Slow CompressionLevel = 1 Slowest CompressionLevel = 2 )
/ Compression levels from fastest (low/zero compression ratio) to slowest (high compression ratio).
type Extractor ¶
Extractor is an interface for the Extract method.
func NewExtractor ¶
NewExtractor returns a new Extractor of the specified format.
The extractor will extract files to the directory provided.
type GzipArchiver ¶
type GzipArchiver struct {
// contains filtered or unexported fields
}
GzipArchiver is a gzip stream archiver.
type NewArchiverCallback ¶
NewArchiverCallback is the callback called when registering a new archiver.
type NewExtractorCallback ¶
NewExtractorCallback is the callback called when registering a new extractor.
type RawArchiver ¶
type RawArchiver struct {
// contains filtered or unexported fields
}
RawArchiver is a raw archiver. It doesn't support compression nor multiple files.
type ZipArchiver ¶
type ZipArchiver struct {
// contains filtered or unexported fields
}
ZipArchiver is a zip archiver.
type ZipExtractor ¶
type ZipExtractor struct {
// contains filtered or unexported fields
}
ZipExtractor is a zip extractor.