Documentation
¶
Overview ¶
Package carchivum works with compressed archives.
Carchivum supports zip and tar. For tar, archiver also supports the following compression:
gzip bzip2 lz4
When creating a tar, compression is not optional. Carchivum does not support everything tar does. If a compression algorithm is used that tar does not support, tar will not be able to decompress it; otherwise it should be compatible with tar, for now.
Index ¶
- Variables
- func Extract(dst, src string) error
- func IsSupported(format magicnum.Format) bool
- func ZipBytes(b []byte, name string) (n int, zipped []byte, err error)
- type Car
- type Tar
- func (t *Tar) Create(src ...string) (cnt int, err error)
- func (t *Tar) CreateGZip(w io.Writer) (err error)
- func (t *Tar) CreateLZ4(w io.Writer) (err error)
- func (t *Tar) Delete() error
- func (t *Tar) Extract() error
- func (t *Tar) ExtractArchive(src io.Reader) error
- func (t *Tar) ExtractGzip(src io.Reader) (err error)
- func (t *Tar) ExtractLZ4(src io.Reader) error
- func (t *Tar) ExtractTar(src io.Reader) (err error)
- func (t *Tar) ExtractTbz(src io.Reader) error
- func (t *Tar) ExtractTgz(src io.Reader) error
- func (t *Tar) Write() (*sync.WaitGroup, error)
- type Zip
Constants ¶
This section is empty.
Variables ¶
var CPUMultiplier = 4
CPUMultiplier set the multiplier to some default value.
var MaxRand = 10000
MaxRand default max random number for pseudo-random number generation.
Functions ¶
func Extract ¶
Extract can handle the processing and extraction of a source file. Dst is the destination directory of the output, if a location other than the CWD is desired. The source file can be a zip, tar, or compressed tar.
func IsSupported ¶
IsSupported returns whether or not a specific format is supported.
Types ¶
type Car ¶
type Car struct { // Name of the archive, this includes path information, if any. Name string UseLongExt bool OutDir string // Create operation modifiers Owner int Group int os.FileMode // Extract operation modifiers UseFullpath bool DeleteArchived bool // Exclude file processing Exclude string ExcludeExt []string ExcludeExtCount int ExcludeAnchored string // Include file processing Include string IncludeExt []string IncludeExtCount int IncludeAnchored string // File time format handling Newer string NewerMTime time.Time NewerFile string // Processing queue FileCh chan *os.File 𝛥t float64 // contains filtered or unexported fields }
Car is a Compressed Archive. The struct holds information about Cars and their processing.
type Tar ¶
Tar is a struct for a tar, tape archive.
func (*Tar) CreateGZip ¶
CreateGZip creates a GZip using the passed writer.
func (*Tar) Extract ¶
Extract extracts the files from the src and writes them to the dst. The src is either a tar or a compressed tar.
func (*Tar) ExtractArchive ¶
ExtractArchive takes a compressed tar archive, as an io.Reader. If the compression format used is supported, it will decompress and extract the contents of the tar; otherwise it will return an error.
func (*Tar) ExtractGzip ¶
ExtractGzip reads a GZip using the passed reader.
func (*Tar) ExtractLZ4 ¶
ExtractLZ4 extracts LZ4 compressed tarballs.
func (*Tar) ExtractTar ¶
ExtractTar extracts a tar file using the passed reader
func (*Tar) ExtractTbz ¶
ExtractTbz extracts Bzip2 compressed tarballs.
func (*Tar) ExtractTgz ¶
ExtractTgz extracts GZip'd tarballs.