pyzstd provides high-performance Python bindings for the Zstandard (zstd) lossless compression algorithm. It enables fast compression and decompression for bytes-like objects and file streams, leveraging the C zstd library. The current stable version is 0.19.1, and it is actively maintained with regular releases.
pip install pyzstdVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic compression and decompression of bytes-like objects using the top-level `zstd.compress` and `zstd.decompress` functions, including specifying a compression level.
For file-like objects, use `zstd.ZstdCompressor().compress_stream()` or `zstd.ZstdDecompressor().decompress_stream()`. Alternatively, use `zstd.open_compressed_file()` for stream-based file I/O.
For efficient processing of file-like objects (e.g., `io.BytesIO`, file handles), instantiate `zstd.ZstdCompressor()` or `zstd.ZstdDecompressor()` and use their `compress_stream()` or `decompress_stream()` methods.
Carefully select compression levels based on your application's balance of compression ratio and performance requirements. Always ensure the level is within the valid range [1, 22].
No dependency data recorded yet.