1 Star 0 Fork 0

h79 / goutils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
lz4.go 624 Bytes
一键复制 编辑 原始数据 按行查看 历史
huqiuyun 提交于 2022-11-01 20:57 . 上传文件调整
package compress
import (
"fmt"
"github.com/hungys/go-lz4"
)
type LZ4 struct{}
// Name returns name of the algorithm LZ4
func (l LZ4) Name() string { return "LZ4" }
// CompressBound max size of compressed data
func (l LZ4) CompressBound(size int) int { return lz4.CompressBound(size) }
// Compress using LZ4 algorithm
func (l LZ4) Compress(dst, src []byte) (int, error) {
return lz4.CompressDefault(src, dst)
}
// Decompress using LZ4 algorithm
func (l LZ4) Decompress(dst, src []byte) (int, error) {
if len(src) == 0 {
return 0, fmt.Errorf("decompress an empty input")
}
return lz4.DecompressSafe(src, dst)
}
Go
1
https://gitee.com/h79/goutils.git
git@gitee.com:h79/goutils.git
h79
goutils
goutils
v1.20.57

搜索帮助