khenaidoo | d948f77 | 2021-08-11 17:49:24 -0400 | [diff] [blame] | 1 | package sarama |
2 | |||||
3 | import ( | ||||
4 | "github.com/klauspost/compress/zstd" | ||||
5 | ) | ||||
6 | |||||
7 | var ( | ||||
8 | zstdDec, _ = zstd.NewReader(nil) | ||||
9 | zstdEnc, _ = zstd.NewWriter(nil, zstd.WithZeroFrames(true)) | ||||
10 | ) | ||||
11 | |||||
12 | func zstdDecompress(dst, src []byte) ([]byte, error) { | ||||
13 | return zstdDec.DecodeAll(src, dst) | ||||
14 | } | ||||
15 | |||||
16 | func zstdCompress(dst, src []byte) ([]byte, error) { | ||||
17 | return zstdEnc.EncodeAll(src, dst), nil | ||||
18 | } |