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/snappyoffering better compression and concurrent streams. - lzw is a drop-in replacement for
compress/lzwwith 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).
- 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.
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
nounsafetag to disable all use of the "unsafe" package. - Use the
noasmtag to disable all assembly across packages.
Use the links above for more information on each.
-
Sep 25th, 2026 1.20.1
- zstd: Apply reset options to reused frame decoders by @pellared in #1226
- flate: Report unexpected EOF for truncated Huffman extra bits by @rupayon123 in #1229
- flate: Avoid FMA in EstimatedBits for portable rounding by @malt3 in #1224
- gzhttp: Preserve caller request headers in Transport by @jakezwang in #1225
- gzhttp: Only decompress a request when gzip is the outermost coding by @youdie006 in #1223
- zstd/huff0: Optimizations by @lizthegrey in #1203 #1205 #1207 #1204 #1208 #1211 #1209 #1210
- flate: Speed improvements by @alex in #1220 #1218 #1216 #1215 #1214 #1217
-
Sep 2nd, 2026 1.20.0