ary/index_
ary/ projects/ kompress

kompress

a minimal cli for streaming zstd compression with progress. what `pv | zstd` should have been.

// about

I wrote kompress because piping pv into zstd loses the progress indicator whenever the output is redirected. kompress handles streaming compression with a proper stderr progress bar regardless of output destination, and adds a few quality-of-life features: atomic output files, automatic compression-level tuning based on input size, and a sensible default that outperforms zstd -3 on realistic workloads.

It is a single static binary, no dependencies, works offline, and is boring by design. Ships with a man page.

why it exists

At work I compress a lot of large datasets. The shell idiom pv file | zstd -T0 > file.zst works, but the progress bar only draws when pv’s stdout is a terminal. Redirecting to a file — which is the normal case — silences it.

I wanted three things, in order:

  • progress on stderr so it survives redirection
  • atomic output (no half-written files on interrupt)
  • one static binary, portable across my machines

Everything else — compression levels, chunk sizes, parallelism — I wanted to not have to think about. The tool should pick good defaults and let me override only when I cared.

design notes

The compression level is tuned dynamically based on input size. Small files get the fastest level (-1), medium files get -3, large files get -9 with long-range mode enabled. This is 90% of what people manually tune for, automated.

Atomic output works by writing to foo.zst.part and renaming to foo.zst only after a successful fsync. If you Ctrl-C mid-compress, the partial file stays as .part and doesn’t shadow any existing foo.zst.

install

linux and macos

# download, verify, install to ~/.local/bin
curl -LO https://ary.example.com/releases/kompress/v1.3.0/kompress-1.3.0-linux-x86_64.tar.gz
curl -LO https://ary.example.com/releases/kompress/v1.3.0/SHA256SUMS
sha256sum --check SHA256SUMS --ignore-missing
tar -xzf kompress-1.3.0-linux-x86_64.tar.gz
mv kompress ~/.local/bin/
kompress --version

On macOS, replace the first URL with the macos-universal.tar.gz and use shasum -a 256 instead of sha256sum.

windows

Download the windows-x86_64.zip from the sidebar, extract it, and place kompress.exe somewhere on your PATH. Open PowerShell and run kompress --version to verify.

from source

Requires Go 1.22 or newer.

curl -LO https://ary.example.com/releases/kompress/v1.3.0/kompress-1.3.0-src.tar.gz
tar -xzf kompress-1.3.0-src.tar.gz
cd kompress-1.3.0
go build -o kompress ./cmd/kompress
./kompress --version

usage

# compress a file (progress on stderr, output to foo.zst)
kompress foo.txt

# compress stdin to stdout (classic pipe usage)
cat foo.txt | kompress > foo.txt.zst

# explicit level
kompress -l 19 bigfile.tar

# decompress
kompress -d foo.txt.zst

Run kompress --help for the full flag list.