Tins · Primitives
zstd
A Mojo binding to libzstd — one-shot and streaming, both directions — through a small C shim loaded at runtime, so consumers need no link flags.
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 zstd-mojo --git https://github.com/magmalake/zstd.mojo --rev 76190bb31012cd2d2f6712c4e1724a66474215db No mojoshelf needed. If pixi reports duplicate records, the mojoshelf tab picks revisions that agree.
Version
0.1.5 on mojoshelf
Source
What it does
Works today
- One-shot and streaming compress and decompress
- Frame introspection: is_zstd_frame, frame_content_size
- The shim is dlopen'd once, not per call
Correctness
Checked against Python zstandard, against independently produced frames baked in as constants