github.com/klauspost/compress bundles fast Go implementations of zstd, gzip, snappy, deflate, LZW, and related codecs. It also includes HTTP wrappers and dictionary tooling.
Overview
compress is a Go module that collects performance-oriented compression and decompression packages for use in applications and services. It is added to projects with go get and tracks supported Go releases per the module’s stated compatibility policy.
Included codecs cover zstandard in pure Go, a snappy implementation advertised as a drop-in replacement with improved compression and concurrent streams, faster LZW than the standard library, huff0 and FSE entropy codecs, Microsoft XPRESS decompression, experimental dictionary builders, and zip or gzip related utilities. The gzhttp package adds client and server helpers for gzip- and zstd-aware HTTP handling.
Build tags let consumers disable unsafe code or assembly across packages when they need stricter portability. The changelog documents ongoing work on arm64 assembly, GPU-adjacent consumers indirectly via other projects, stream encoding, and format-specific bug fixes.
Teams embed these packages directly in Go programs rather than running a separate service. Documentation is organized per subpackage for zstd, s2, flate, and the other formats under the same import path.
Key features
- zstd encode and decode
- Snappy-compatible s2 streams
- flate and gzip improvements
- LZW faster than stdlib
- XPRESS decompression support
- Experimental compression dictionaries
- gzhttp for compressed HTTP
- Optional noasm and nosafe builds
Use cases
- Go service payload compression
- High-throughput log or blob storage
- HTTP content encoding middleware
- Custom zstd dictionary pipelines