Skip to content
Latchkey

zstdcat: Stream zstd Files to stdout

zstdcat decompresses a .zst file to stdout without touching disk, equivalent to zstd -dc, so you can stream a zstd build cache straight into tar.

zstdcat is the .zst member of the *cat family, and the natural way to restore a zstd-compressed cache into a pipe. It handles the same --long window as zstd.

What it does

zstdcat reads one or more .zst files and writes their decompressed contents to stdout, the same as zstd -dc or unzstd -c. It respects --long for files compressed with a large window. Nothing is written to disk.

Common usage

Terminal
zstdcat deps.tar.zst | tar -x        # restore a cache via a pipe
zstdcat app.log.zst | grep ERROR
zstdcat --long=31 big.tar.zst | tar -t
zstdcat a.zst b.zst > combined.txt

Options

ItemWhat it does
zstdcat <file.zst>Decompress to stdout (like zstd -dc)
--long[=<n>]Set window log to decode --long files
multiple filesConcatenate all decompressed outputs
-f / --forcePass through or overwrite as needed

In CI

zstdcat is the fast path to restore a zstd build cache: zstdcat cache.tar.zst | tar -x avoids a scratch file. It ships with the zstd package. If the cache was written with --long, add --long=31 or the decode errors on the window size.

Common errors in CI

"zstd: /*stdin*\\: unsupported format" means the input is not zstd; use the matching viewer. "Frame requires too much memory for decoding" means a --long file needs --long=31 to decode. "command not found" means the zstd package is missing.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →