zstdify-cli
v1.4.0
Published
CLI for zstd compression and decompression using zstdify
Downloads
1,096
Readme
zstdify-cli

Command-line tool for compressing and decompressing files with zstd. Built on the zstdify package (pure TypeScript, no native dependencies).
Features
- Pure JS/TS zstd CLI: No native addon dependency, portable across Node.js environments.
- Compression + extraction workflows: Simple file-to-file commands with level/checksum controls.
- Interop-focused: Files produced by
zstdifyare decoded by the officialzstdCLI, andzstdoutput is decoded byzstdify. - Robust command UX: Clear subcommands, aliases, and actionable error messages.
- Optional dictionary support: Train dictionaries from samples and use them with
compress/extractwhen needed.
Installation
pnpm add -g zstdify-cliCommands
| Command | Description |
| ------- | ----------- |
| zstdify compress <input> <output> | Compress a file with zstd |
| zstdify extract <input> <output> | Decompress a zstd-compressed file |
| zstdify dict train <output> --input <path>... | Train a dictionary from sample files/directories |
Aliases: compress / c, extract / x.
Options (compress)
--level,-l— Compression level (0=raw, 1+=RLE, 2+=compressed blocks)--checksum— Add content checksum to the frame--dict— Dictionary file path to use for compression--dictID— Dictionary ID to store in the frame header--noDictId— Do not write dictID in frame header
Options (extract)
--dict— Dictionary file path for dictionary-compressed input--dictID— Expected dictionary ID for validation
Options (dict train)
--recursive— Recursively collect files from input directories--maxSamples— Maximum number of sample files to load--algorithm—fastcover,cover, orlegacy--maxdict— Maximum dictionary size in bytes--dictID— Optional dictionary ID metadata setting- Advanced tuning knobs:
--k,--d,--steps,--split,--f,--accel,--selectivity,--shrink
Examples
zstdify compress input.txt output.zst
zstdify compress input.txt output.zst --level 2
zstdify extract output.zst restored.txt
zstdify dict train my.dict --input samples/ --recursive --maxdict 2048
zstdify compress input.txt output.zst --dict my.dict --dictID 42
zstdify extract output.zst restored.txt --dict my.dict --dictID 42How we validate
CLI behavior is covered by automated tests (pnpm vitest, including packages/cli-tests):
- CLI round-trip:
zstdify compress->zstdify extractrestores original file bytes. - Core flags and aliases: Compression levels, checksums, and command aliases are exercised.
- Differential interop with official zstd CLI:
zstdoutput is extracted byzstdify-cli.zstdify-clioutput is decompressed byzstd.- These checks run across standard (non-dictionary) workflows.
- Dictionary interop coverage:
zstd -D dictcompressed streams are extracted byzstdify-cli --dict.zstdify-cli --dictcompressed streams are decompressed byzstd -D dict.- Coverage includes both zstd-trained and zstdify-trained dictionaries.
- Error paths: Missing files and invalid inputs produce non-zero exits and actionable messages.
Acknowledgements
This project is made possible by the original zstd project by Meta and its contributors. The monorepo, project, and CLI structure were bootstrapped from hdrify, which made this project much easier to build.
License
MIT
Author
Ben Houston, Sponsored by Land of Assets
