blob: e23bfc4772f7771c62cce2cc8b7ef4da6b1a1c07 [file] [log] [blame]
khenaidoo7d3c5582021-08-11 18:09:44 -04001package sarama
2
3import (
4 "github.com/klauspost/compress/zstd"
5)
6
7var (
8 zstdDec, _ = zstd.NewReader(nil)
9 zstdEnc, _ = zstd.NewWriter(nil, zstd.WithZeroFrames(true))
10)
11
12func zstdDecompress(dst, src []byte) ([]byte, error) {
13 return zstdDec.DecodeAll(src, dst)
14}
15
16func zstdCompress(dst, src []byte) ([]byte, error) {
17 return zstdEnc.EncodeAll(src, dst), nil
18}