gcompress

package
v2.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 13 Imported by: 28

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gzip

func Gzip(data []byte, level ...int) ([]byte, error)

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 GzipFile

func GzipFile(srcFilePath, dstFilePath string, level ...int) (err error)

GzipFile compresses the file `src` to `dst` using gzip algorithm.

func GzipPathWriter added in v2.2.0

func GzipPathWriter(filePath string, writer io.Writer, level ...int) error

GzipPathWriter compresses `filePath` to `writer` using gzip compressing algorithm.

Note that the parameter `path` can be either a directory or a file.

func UnGzip

func UnGzip(data []byte) ([]byte, error)

UnGzip decompresses `data` with gzip algorithm.

func UnGzipFile

func UnGzipFile(srcFilePath, dstFilePath string) error

UnGzipFile decompresses srcFilePath `src` to `dst` using gzip algorithm.

func UnZipContent

func UnZipContent(zippedContent []byte, dstFolderPath string, zippedPrefix ...string) error

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

func UnZipFile(zippedFilePath, dstFolderPath string, zippedPrefix ...string) error

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 UnZlib

func UnZlib(data []byte) ([]byte, error)

UnZlib decompresses `data` with zlib algorithm.

func ZipPath

func ZipPath(fileOrFolderPaths, dstFilePath string, prefix ...string) error

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

func ZipPathContent(fileOrFolderPaths string, prefix ...string) ([]byte, error)

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

func ZipPathWriter(fileOrFolderPaths string, writer io.Writer, prefix ...string) error

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.

func Zlib

func Zlib(data []byte) ([]byte, error)

Zlib compresses `data` with zlib algorithm.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL