Documentation
¶
Overview ¶
Package unpackit allows you to easily unpack *.tar.gz, *.tar.bzip2, *.tar.xz, *.zip and *.tar files. There are not CGO involved nor hard dependencies of any type.
Index ¶
- func MagicNumber(reader *bufio.Reader, offset int) (string, error)
- func Sanitize(name string) string
- func UnpackFS(fs fs.FS, filename string, destPath string) error
- func UnpackFile(filename string, destPath string) error
- func UnpackReader(reader io.Reader, destPath string) error
- func UntarFS(fs fs.FS, filename string, destPath string) error
- func UntarFile(filename string, destPath string) error
- func UntarReader(data io.Reader, destPath string) error
- func UnzipFS(fs fs.FS, filename string, destPath string) error
- func UnzipFile(filename string, destPath string) error
- func UnzipReader(r io.Reader, destPath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MagicNumber ¶
Check whether a file has the magic number for tar, gzip, bzip2 or zip files
Note that this function does not advance the Reader.
50 4b 03 04 for pkzip format 1f 8b for .gz format 42 5a for .bzip format 75 73 74 61 72 at offset 257 for tar files fd 37 7a 58 5a 00 for .xz format
func UnpackFile ¶
UnpackFile is a helper function to easily unpack TAR files
func UnpackReader ¶
UnpackReader unpacks a compressed stream. Magic numbers are used to determine what decompressor and/or unarchiver to use.
func UntarReader ¶
UntarReader unarchives a TAR archive and returns the final destination path or an error
Types ¶
This section is empty.