Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnknown = errors.New("unknown compression format") ErrEmpty = errors.New("no data to read") )
Functions ¶
func IsBZip2 ¶
IsBZip2 checks to see if the received reader's contents are in bzip2 format by checking the magic numbers.
func IsGZip ¶
IsGZip checks to see if the received reader's contents are in gzip format by checking the magic numbers.
func IsLZ4 ¶
IsLZ4 checks to see if the received reader's contents are in LZ4 foramt by checking the magic numbers.
Types ¶
type Format ¶
type Format int
const ( Unknown Format = iota // unknown format GZip // Gzip compression format BZip2 // Bzip2 compression LZ4 // LZ4 compression Tar // Tar format; normally used Tar1 // Tar1 magicnum format; normalizes to Tar Tar2 // Tar1 magicnum format; normalizes to Tar Zip // Zip archive ZipEmpty // Empty Zip Archive ZipSpanned // Spanned Zip Archive )
func GetFormat ¶
GetFormat tries to match up the data in the Reader to a supported magic number, if a match isn't found, UnsupportedFmt is returned
For zips, this will also match on files with empty zip or spanned zip magic numbers. If you need to distinguich between the various zip formats, use something else.
func ParseFormat ¶
ParseFormat takes a string and returns the format or unknown. Any compressed tar extensions are returned as the compression format and not tar.
If the passed string starts with a '.', it is removed. All strings are lowercased