Documentation ¶
Overview ¶
Package archive is used to read and write tar files
Index ¶
- Variables
- func Compress(r io.Reader, oComp CompressType) (io.Reader, error)
- func Decompress(r io.Reader) (io.Reader, error)
- func Extract(ctx context.Context, path string, r io.Reader, opts ...TarOpts) error
- func Tar(ctx context.Context, path string, w io.Writer, opts ...TarOpts) error
- func TarCompressGzip(to *tarOpts)
- func TarUncompressed(to *tarOpts)
- type CompressType
- type TarOpts
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotImplemented used for routines that need to be developed still ErrNotImplemented = errors.New("this archive routine is not implemented yet") // ErrUnknownType used for unknown compression types ErrUnknownType = errors.New("unknown compression type") // ErrXzUnsupported because there isn't a Go package for this and I'm // avoiding dependencies on external binaries ErrXzUnsupported = errors.New("xz compression is currently unsupported") )
Functions ¶
func Decompress ¶
Decompress extracts gzip and bzip streams
func TarCompressGzip ¶ added in v0.3.9
func TarCompressGzip(to *tarOpts)
TarCompressGzip option to use gzip compression on tar files
func TarUncompressed ¶ added in v0.3.9
func TarUncompressed(to *tarOpts)
TarUncompressed option to tar (noop)
Types ¶
type CompressType ¶
type CompressType int
CompressType identifies the detected compression type
const ( // CompressNone detected no compression CompressNone CompressType = iota // CompressBzip2 compression CompressBzip2 // CompressGzip compression CompressGzip // CompressXz compression CompressXz )
func DetectCompression ¶
func DetectCompression(head []byte) CompressType
DetectCompression identifies the compression type based on the first few bytes
func (CompressType) String ¶ added in v0.4.3
func (ct CompressType) String() string
Click to show internal directories.
Click to hide internal directories.