Zstandard decompression in pure Python
Project description
fzstd - Python Edition
A Python translation of the high-performance Zstandard (de)compression library fzstd.
This is a pure Python implementation of Zstandard decompression that aims to be compatible with the original TypeScript version.
LLM-driven translation from TypeScript.
Installation
pip install fzstd
Or for development:
pip install -e .
Usage
Basic Decompression
import fzstd
# Decompress data
compressed_data = b'\x28\xb5\x2f\xfd...' # zstandard compressed bytes
decompressed = fzstd.decompress(bytes(compressed_data))
text = decompressed.decode('utf-8')
print(text)
Streaming Decompression
For decompressing large files or data streams, use the Decompress class:
import fzstd
def handle_chunk(chunk: bytes, final: bool) -> None:
print(f"Decompressed {len(chunk)} bytes")
if final:
print("Decompression complete")
# Create a decompressor with a handler
decompressor = fzstd.Decompress(handle_chunk)
# Push compressed data chunks
decompressor.push(chunk1)
decompressor.push(chunk2)
decompressor.push(final_chunk, final=True)
Limitations
- Maximum backreference distance: 2^25 bytes (same as TypeScript version)
- Not compatible with "ultra" compression levels (20+) for files > 32MB decompressed
- And more!
Testing
Run the test suite:
python tests.py
Origin
This is a translation of the fzstd TypeScript library by Arjun Barrett (@101arrowz).
Original repository: https://github.com/101arrowz/fzstd
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fzstd-0.1.1.tar.gz.
File metadata
- Download URL: fzstd-0.1.1.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cef3f222d00c86a7b537c550de3c7121421439279e288cac4a856724dc6f7b6
|
|
| MD5 |
19eef61cc4623bb2a71d5365fc26bdae
|
|
| BLAKE2b-256 |
28a51f025b6f348dea0ef0176c567a94e2cda19332f64efb8526962f74b0b2e2
|
Provenance
The following attestation bundles were made for fzstd-0.1.1.tar.gz:
Publisher:
pypi.yml on dholth/fzstdpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fzstd-0.1.1.tar.gz -
Subject digest:
9cef3f222d00c86a7b537c550de3c7121421439279e288cac4a856724dc6f7b6 - Sigstore transparency entry: 1574245212
- Sigstore integration time:
-
Permalink:
dholth/fzstdpy@1c4a634972e4b5213dccbdfceb6055720e4d2943 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/dholth
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@1c4a634972e4b5213dccbdfceb6055720e4d2943 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fzstd-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fzstd-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9cf2677a0b792656bf8a0b1b2ef7117dfc293ab111b5a479edf7ae3d62c8f51
|
|
| MD5 |
40511861c3038abb2c2794e4728c1668
|
|
| BLAKE2b-256 |
6dc143c8aabdd73a6da9b493fb2b83a099f11a320a9f309c84ec07d31e01f97d
|
Provenance
The following attestation bundles were made for fzstd-0.1.1-py3-none-any.whl:
Publisher:
pypi.yml on dholth/fzstdpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fzstd-0.1.1-py3-none-any.whl -
Subject digest:
b9cf2677a0b792656bf8a0b1b2ef7117dfc293ab111b5a479edf7ae3d62c8f51 - Sigstore transparency entry: 1574245548
- Sigstore integration time:
-
Permalink:
dholth/fzstdpy@1c4a634972e4b5213dccbdfceb6055720e4d2943 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/dholth
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@1c4a634972e4b5213dccbdfceb6055720e4d2943 -
Trigger Event:
push
-
Statement type: