压缩类

package
v0.0.0-...-2910145 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

包gcompress提供了多种压缩算法,适用于二进制/字节数据。

包gcompress提供了多种压缩算法,适用于二进制/字节数据。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gzip压缩字节集

func Gzip压缩字节集(字节集 []byte, 可选压缩级别 ...int) ([]byte, error)

Gzip 使用gzip算法压缩`data`。 可选参数`level`指定压缩级别,范围从1到9, 这意味着从无压缩到最佳压缩。

注意,如果给定的`level`无效,将会返回错误。

func Gzip压缩文件

func Gzip压缩文件(文件路径, 压缩文件路径 string, 可选压缩级别 ...int) (错误 error)

GzipFile 使用gzip算法将文件`src`压缩到`dst`。

func Gzip压缩文件到Writer

func Gzip压缩文件到Writer(文件路径 string, writer io.Writer, 可选压缩级别 ...int) error

GzipPathWriter 使用gzip压缩算法将`filePath`压缩并写入到`writer`。

注意,参数`path`可以是一个目录或一个文件。

func Gzip解压字节集

func Gzip解压字节集(gzip字节集 []byte) ([]byte, error)

UnGzip 使用gzip算法对`data`进行解压缩

func Gzip解压文件

func Gzip解压文件(gzip文件路径, 文件路径 string) error

UnGzipFile 使用gzip算法将源文件路径`src`解压缩到`dst`。

func Zip压缩文件

func Zip压缩文件(目录或文件, 压缩文件路径 string, 可选路径前缀 ...string) error

ZipPath 使用zip压缩算法将`fileOrFolderPaths`压缩到`dstFilePath`。

参数`paths`可以是目录或文件,支持使用','连接的多个路径。 可选参数`prefix`表示zip文件中的路径前缀。

func Zip压缩文件到Writer

func Zip压缩文件到Writer(目录或文件 string, writer io.Writer, 可选路径前缀 ...string) error

ZipPathWriter 使用zip压缩算法将`fileOrFolderPaths`压缩到`writer`。

注意参数`fileOrFolderPaths`可以是目录或文件,支持使用','连接的多个路径。 可选参数`prefix`表示zip文件中的路径前缀。

func Zip压缩文件到字节集

func Zip压缩文件到字节集(目录或文件 string, 可选路径前缀 ...string) ([]byte, error)

ZipPathContent 使用zip压缩算法将`fileOrFolderPaths`压缩为[]byte。

注意,参数`fileOrFolderPaths`可以是目录或文件,支持使用','连接多个路径。 可选参数`prefix`表示zip文件中的路径前缀。

func Zip解压字节集

func Zip解压字节集(zip字节集 []byte, 解压目录 string, 可选路径前缀 ...string) error

UnZipContent 使用zip压缩算法将`zippedContent`解压到`dstFolderPath`。

参数`dstFolderPath`应该是一个目录。 参数`zippedPrefix`指定了`zippedContent`解压后的路径, 可用于指定要解压的归档文件的部分。 进一步细化翻译: ```go UnZipContent 函数负责使用ZIP压缩算法将压缩内容 `zippedContent` 解压到目标文件夹 `dstFolderPath`。

参数 `dstFolderPath` 必须是一个存在的目录,解压后的文件将存放在此目录下。 参数 `zippedPrefix` 指定 `zippedContent` 中待解压内容的相对路径前缀, 通过此参数可以选择性地解压归档文件中的特定部分。

func Zip解压文件

func Zip解压文件(压缩包路径, 解压目录 string, 可选路径前缀 ...string) error

UnZipFile 使用zip压缩算法将`archive`解压到`dstFolderPath`。

参数`dstFolderPath`应为一个目录。 可选参数`zippedPrefix`用于指定`zippedFilePath`解压后的路径前缀, 该参数可用于指定只解压归档文件中的部分内容。

func Zlib压缩字节集

func Zlib压缩字节集(字节集 []byte) ([]byte, error)

Zlib 使用zlib算法压缩`data`。

func Zlib解压字节集

func Zlib解压字节集(字节集 []byte) ([]byte, error)

UnZlib 使用zlib算法对`data`进行解压缩。

Types

This section is empty.

Jump to

Keyboard shortcuts

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