Documentation ¶
Index ¶
Constants ¶
View Source
const ( LevelNoCompression = gzip.NoCompression LevelBestSpeed = gzip.BestSpeed LevelBestCompression = gzip.BestCompression )
Variables ¶
View Source
var ( GzipFile func(srcFilePath, dstFilePath string, level ...int) (err error) = gcompress.GzipFile GzipPathWriter func(filePath string, writer io.Writer, level ...int) error = gcompress.GzipPathWriter )
View Source
var (
UnGzipFile func(srcFilePath, dstFilePath string) error = gcompress.UnGzipFile
)
Functions ¶
func AssertValidLevel ¶ added in v3.0.52
func Compress ¶ added in v3.0.52
func Compress(data []byte, options ...GzipOption) ([]byte, error)
Compress
PS: 前端的解压,可以参考 notes/_Vue3Projects/ws-client 中的 GzipKit.
Types ¶
type GzipOption ¶ added in v3.0.52
type GzipOption func(opts *gzipOptions)
func WithCompressThreshold ¶ added in v3.0.57
func WithCompressThreshold(compressThreshold int) GzipOption
WithCompressThreshold 设置: 最小压缩长度阈值
func WithLevel ¶ added in v3.0.52
func WithLevel(level int) GzipOption
Click to show internal directories.
Click to hide internal directories.