Documentation
¶
Overview ¶
gcompress 包提供了针对二进制/字节数据的各种压缩算法。 md5:eb6f1752b091375d
gcompress 包提供了针对二进制/字节数据的各种压缩算法。 md5:eb6f1752b091375d
Index ¶
- func Gzip压缩字节集(字节集 []byte, 可选压缩级别 ...int) ([]byte, error)
- func Gzip压缩文件(文件路径, 压缩文件路径 string, 可选压缩级别 ...int) (错误 error)
- func Gzip压缩文件到Writer(文件路径 string, writer io.Writer, 可选压缩级别 ...int) error
- func Gzip解压字节集(gzip字节集 []byte) ([]byte, error)
- func Gzip解压文件(gzip文件路径, 文件路径 string) error
- func Zip压缩文件(目录或文件, 压缩文件路径 string, 可选路径前缀 ...string) error
- func Zip压缩文件到Writer(目录或文件 string, writer io.Writer, 可选路径前缀 ...string) error
- func Zip压缩文件到字节集(目录或文件 string, 可选路径前缀 ...string) ([]byte, error)
- func Zip解压字节集(zip字节集 []byte, 解压目录 string, 可选路径前缀 ...string) error
- func Zip解压文件(压缩包路径, 解压目录 string, 可选路径前缀 ...string) error
- func Zlib压缩字节集(字节集 []byte) ([]byte, error)
- func Zlib解压字节集(字节集 []byte) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Gzip压缩字节集 ¶
Gzip压缩字节集 使用 gzip 算法压缩 `data`。 可选参数 `level` 指定压缩级别,范围从 1 到 9,1 表示无压缩,9 表示最佳压缩。
注意,如果给定的 `level` 不合法,它将返回错误。 md5:55af48098fabf71a
func Gzip压缩文件到Writer ¶
Gzip压缩文件到Writer 使用gzip压缩算法将`filePath`的内容压缩并写入到`writer`中。
注意,参数`path`既可以是一个目录,也可以是一个文件。 md5:5da525f970882d97
func Zip压缩文件 ¶
Zip压缩文件 使用zip压缩算法将`fileOrFolderPaths`压缩到`dstFilePath`。
参数`paths`可以是目录或文件,支持使用`,`连接多个路径。参数`prefix`(可选)表示zip文件的路径前缀。 md5:6754e1656d2dfc22
func Zip压缩文件到Writer ¶
Zip压缩文件到Writer 使用zip压缩算法将`fileOrFolderPaths`压缩到`writer`中。
注意,参数`fileOrFolderPaths`可以是目录或文件,支持使用','连接多个路径。 参数`prefix`(可选)表示zip文件的路径前缀。 md5:0e6a4ca6fdf7a9d7
func Zip压缩文件到字节集 ¶
Zip压缩文件到字节集 使用zip压缩算法将`fileOrFolderPaths`压缩为[]byte。
注意,参数`fileOrFolderPaths`可以是目录或文件,支持使用逗号','连接多个路径。 不强制要求的参数`prefix`表示zip文件中的路径前缀。 md5:6700858e8ecb32a5
func Zip解压字节集 ¶
Zip解压字节集 使用zip压缩算法将`zippedContent`解压缩到`dstFolderPath`。
参数`dstFolderPath`应该是一个目录。参数`zippedPrefix`指定了`zippedContent`的解压路径,可以用来指定要解压的归档文件的一部分。 md5:808f21381d5e3681
func Zip解压文件 ¶
Zip解压文件 使用 ZIP 压缩算法将 `archive` 解压缩到 `dstFolderPath`。
参数 `dstFolderPath` 应该是一个目录。可选参数 `zippedPrefix` 指定了 `zippedFilePath` 的解压缩路径部分,可以用来指定要解压缩的归档文件的一部分。 md5:4ef9114de36ab1d8
Types ¶
This section is empty.