klauspost /compress

Optimized Go Compression Packages

★ 5,727⑂ 437👁 63⑃ 880● 324▤ 121
GoNOASSERTIONCreated 2015-07-21
Download: v1.20.4v1.20.4 ↓1.20.42026-11-09
+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

Discussions

Latest release

v1.20.4 v1.20.4 2026-11-09
What'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

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON