Documentation ¶
Overview ¶
包gcompress提供了多种压缩算法,适用于二进制/字节数据。
包gcompress提供了多种压缩算法,适用于二进制/字节数据。
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, 这意味着从无压缩到最佳压缩。
注意,如果给定的`level`无效,将会返回错误。
func Zip压缩文件 ¶
ZipPath 使用zip压缩算法将`fileOrFolderPaths`压缩到`dstFilePath`。
参数`paths`可以是目录或文件,支持使用','连接的多个路径。 可选参数`prefix`表示zip文件中的路径前缀。
func Zip压缩文件到Writer ¶
ZipPathWriter 使用zip压缩算法将`fileOrFolderPaths`压缩到`writer`。
注意参数`fileOrFolderPaths`可以是目录或文件,支持使用','连接的多个路径。 可选参数`prefix`表示zip文件中的路径前缀。
func Zip压缩文件到字节集 ¶
ZipPathContent 使用zip压缩算法将`fileOrFolderPaths`压缩为[]byte。
注意,参数`fileOrFolderPaths`可以是目录或文件,支持使用','连接多个路径。 可选参数`prefix`表示zip文件中的路径前缀。
func Zip解压字节集 ¶
UnZipContent 使用zip压缩算法将`zippedContent`解压到`dstFolderPath`。
参数`dstFolderPath`应该是一个目录。 参数`zippedPrefix`指定了`zippedContent`解压后的路径, 可用于指定要解压的归档文件的部分。 进一步细化翻译: ```go UnZipContent 函数负责使用ZIP压缩算法将压缩内容 `zippedContent` 解压到目标文件夹 `dstFolderPath`。
参数 `dstFolderPath` 必须是一个存在的目录,解压后的文件将存放在此目录下。 参数 `zippedPrefix` 指定 `zippedContent` 中待解压内容的相对路径前缀, 通过此参数可以选择性地解压归档文件中的特定部分。
Types ¶
This section is empty.