Documentation ¶
Overview ¶
Package gcompress provides kinds of compression algorithms for binary/bytes data.
Package gcompress provides kinds of compression algorithms for binary/bytes data.
Index ¶
- func Gzip(data []byte, level ...int) ([]byte, error)
- func GzipFile(srcFilePath, dstFilePath string, level ...int) (err error)
- func GzipPathWriter(filePath string, writer io.Writer, level ...int) error
- func UnGzip(data []byte) ([]byte, error)
- func UnGzipFile(srcFilePath, dstFilePath string) error
- func UnZipContent(zippedContent []byte, dstFolderPath string, zippedPrefix ...string) error
- func UnZipFile(zippedFilePath, dstFolderPath string, zippedPrefix ...string) error
- func UnZlib(data []byte) ([]byte, error)
- func ZipPath(fileOrFolderPaths, dstFilePath string, prefix ...string) error
- func ZipPathContent(fileOrFolderPaths string, prefix ...string) ([]byte, error)
- func ZipPathWriter(fileOrFolderPaths string, writer io.Writer, prefix ...string) error
- func Zlib(data []byte) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Gzip ¶
Gzip compresses `data` using gzip algorithm. The optional parameter `level` specifies the compression level from 1 to 9 which means from none to the best compression.
Note that it returns error if given `level` is invalid.
func GzipPathWriter ¶ added in v2.2.0
GzipPathWriter compresses `filePath` to `writer` using gzip compressing algorithm.
Note that the parameter `path` can be either a directory or a file.
func UnGzipFile ¶
UnGzipFile decompresses srcFilePath `src` to `dst` using gzip algorithm.
func UnZipContent ¶
UnZipContent decompresses `zippedContent` to `dstFolderPath` using zip compressing algorithm.
The parameter `dstFolderPath` should be a directory. The parameter `zippedPrefix` specifies the unzipped path of `zippedContent`, which can be used to specify part of the archive file to unzip.
func UnZipFile ¶
UnZipFile decompresses `archive` to `dstFolderPath` using zip compressing algorithm.
The parameter `dstFolderPath` should be a directory. The optional parameter `zippedPrefix` specifies the unzipped path of `zippedFilePath`, which can be used to specify part of the archive file to unzip.
func ZipPath ¶
ZipPath compresses `fileOrFolderPaths` to `dstFilePath` using zip compressing algorithm.
The parameter `paths` can be either a directory or a file, which supports multiple paths join with ','. The unnecessary parameter `prefix` indicates the path prefix for zip file.
func ZipPathContent ¶ added in v2.2.0
ZipPathContent compresses `fileOrFolderPaths` to []byte using zip compressing algorithm.
Note that the parameter `fileOrFolderPaths` can be either a directory or a file, which supports multiple paths join with ','. The unnecessary parameter `prefix` indicates the path prefix for zip file.
func ZipPathWriter ¶
ZipPathWriter compresses `fileOrFolderPaths` to `writer` using zip compressing algorithm.
Note that the parameter `fileOrFolderPaths` can be either a directory or a file, which supports multiple paths join with ','. The unnecessary parameter `prefix` indicates the path prefix for zip file.
Types ¶
This section is empty.