+1
Daily
5,727
stars
437
forks
63
watchers
880
prs
324
issues
121
releases
README
compress This package provides various compression algorithms. zstandard compression and decompression in pure Go. S2 is a high performance replacement for Snappy. Optimized deflate packages which can be used as a dropin replacement for gzip, zip and zlib. snappy is a drop-in replacement for github.com/golang/snappy offering better compression and concurrent streams. lzw is a drop-in replacement for compress/lzw with 1.4-4x faster decompression and 1.1-2.7x faster compression, depending on the data. huff0 and FSE implementations for raw entropy encoding. Xpress decompression of the Microsoft XPRESS (MS-XCA) plain LZ77 and LZ77+Huffman formats (the LZ77+Huffman variant is the one used in WIM images and Windows Compact OS / WOF data). dict is an experimental dictionary builder for Zstandard, S2, LZ4, deflate and more. gzhttp Provides client and server wrappers for handling gzipped/zstd HTTP requests efficiently. pgzip is a separate package that provides a very fast parallel gzip implementation. package usage Use go get github.com/klauspost/compress@latest to add it to your project. This package will support the current Go version and 2 versions back. Use the nounsafe tag to disable all use of the "unsafe" package. Use the noasm tag to disable all assembly across packages. Use the links above for more information on each. changelog Sep 25th, 2026 1.20.1 zstd: Apply reset options to reused frame decoders by @pellared in https://github.com/klauspost/compress/pull/1226 flate: Report unexpected EOF for truncated Huffman extra bits by @rupayon123 in https://github.com/klauspost/compress/pull/1229 flate: Avoid FMA in EstimatedBits for portable rounding by @malt3 in https://github.com/klauspost/compress/pull/1224 gzhttp: Preserve caller request headers in Transport by @jakezwang in https://github.com/klauspost/compress/pull/1225 gzhttp: Only decompress a request when gzip is the outermost coding by @youdie006 in https://github.com/klauspost/compress/pull/1223 zstd/huff0: Optimizations by @lizthegrey in https://github.com/klauspost/compress/pull/1203 https://github.com/klauspost/compress/pull/1205 https://github.com/klauspost/compress/pull/1207 https://github.com/klauspost/compress/pull/1204 https://github.com/klauspost/compress/pull/1208 https://github.com/klauspost/compress/pull/1211 https://github.com/klauspost/compress/pull/1209 https://github.com/klauspost/compress/pull/1210 flate: Speed improvements by @alex in https://github.com/klauspost/compress/pull/1220 https://github.com/klauspost/compress/pull/1218 https://github.com/klauspost/compress/pull/1216 https://github.com/klauspost/compress/pull/1215 https://github.com/klauspost/compress/pull/1214 https://github.com/klauspost/compress/pull/1217 Sep 2nd, 2026 1.20.0 lzw: Add lzw reader/writer in https://github.com/klauspost/compress/pull/1189 xpress: Add Microsoft XPRESS (MS-XCA) decompression by @MP-GOWTHAM in https://github.com/klauspost/compress/pull/11
Top issues
#1275s2: ReadFrom retains bytes.Buffer input after returning2 comments · 2026-10-23#1317gzhttp: buffered Write does not commit the implicit HTTP status1 comments · 2026-11-13#1289zstd: EncodeAll with a dictionary copies the whole 256 KiB fast table for most small inputs (fastEncoderDict.Reset)1 comments · 2026-10-28#1296S2 CLI tools: unsafe output file creation (symlink/TOCTOU, set-ID propagation, tar extraction)0 comments · 2026-11-01#1278zstd: EncodeAll with a dictionary costs ~6–10 µs per small message, mostly building entropy tables0 comments · 2026-10-24#1274Add support for parrallel decode on frame boundaries.0 comments · 2026-10-21
Discussions
#1285zstd, gzhttp: RFC 9842 dictionary-compressed zstd (dcz)1 comments · 2026-10-25#1283zstd: support magicless frames, and decoding frames without a dictionary ID1 comments · 2026-10-24#1264Invalid zip file in release package1 comments · 2026-10-12#1194Is there any chance to support decryption of encrypted files?1 comments · 2026-08-11#1188Adding LZW support?1 comments · 2026-07-30#1162Feature Request / Optimization: FSE-only Literal Compression Fallback for Constrained Alphabet Data (e.g., Base64/DNA) on Fast Levels1 comments · 2026-06-27#1152Expose GZIP/DEFLATE decompressor state (sliding window & bit-offsets) to enable zran / ratarmount style index generation1 comments · 2026-05-20#1138Versioning question: new zstd support introduced in patch release (v1.18.4)1 comments · 2026-03-24
Latest release
v1.20.4 v1.20.4 2026-11-09What's Changed zstd: don't reuse a literal table that was not written by @klauspost in https://github.com/klauspost/compress/pull/1299 zstd: preserve stream state when resetting options by @Grivn in https://github.com/klauspost/compress/pull/1266 zstd, huff0, s2: bump the avo arm64 lowering; keep zstd stack slots in registers by @lizthegrey in https://github.com/klauspost/compress/pull/1248 zstd, huff0: faster pure-Go decoders by @lizthegrey in https://github.com/klauspost/compress/pull/1256 zstd: Don't retain pointers to decoded inputs in DecodeAll by @Jille in https://github.com/kl