Tins · Primitives
deflate
DEFLATE (RFC 1951) and gzip (RFC 1952) in pure Mojo, the compression inside Avro's deflate codec and Parquet's GZIP codec. No FFI, no libz.
Install
plain pixi:
pixi init app -c https://conda.modular.com/max -c conda-forge && cd app
sed -i.bak 's/^\[workspace\]/[workspace]\npreview = ["pixi-build"]/' pixi.toml
pixi add "mojo-compiler==1.2.0"
# Without mojoshelf: the tin as a git dependency at its published commit.
# Transitive dependencies may be wrong: pixi takes the tin's own git deps as
# pinned in its pixi.toml, which may not match what other tins pin, and then
# fails with "duplicate records". mojoshelf picks revisions that agree.
pixi add deflate-mojo --git https://github.com/magmalake/deflate.mojo --rev 6639b18c58fad0e009f4224ec9f792cd919398b4 No mojoshelf needed. If pixi reports duplicate records, the mojoshelf tab picks revisions that agree.
Version
0.1.3 on mojoshelf
What it does
Works today
- inflate for stored, fixed- and dynamic-Huffman blocks
- deflate with a hash-chain LZ77 matcher, fixed-Huffman blocks
- inflate_at for back-to-back streams, as gzip members are
- gunzip for a whole .gz file: every member, header flags, each member's CRC-32 and size checked; gzip to write one
Correctness
Checked against zlib: inflates what zlib wrote, one fixture per block type