Files
chatlog/pkg/util/lz4/lz4.go
2025-03-28 16:48:49 +08:00

17 lines
311 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package lz4
import (
"github.com/pierrec/lz4/v4"
)
func Decompress(src []byte) ([]byte, error) {
// FIXME: lz4 的压缩率预计不到 3这里设置了 4 保险一点
out := make([]byte, len(src)*4)
n, err := lz4.UncompressBlock(src, out)
if err != nil {
return nil, err
}
return out[:n], nil
}