SNAPPY(1)
π SNAPPY π
okay bestie, so snappy and unsnappy are the little tools that do Snappy compression and decompression β with framing and without it. both of them. same page, two names. it's giving twin energy fr fr β¨
β¨ SYNOPSIS β¨
snappy [-f] [file] > snappy.sn|.sz
snappy -d [-i] [file]
unsnappy [-i] [file]
πΈ DESCRIPTION πΈ
No -d in sight? Then we're compressing, babe. It takes file β and if file is "-", or if you just don't give one at all (that's the default), it reads the standard input stream β squishes it with Snappy, drops the result on the standard output stream, and then tells you how good the squeeze was by writing the compression ratio to the standard error stream. And with -f, you get the Snappy framing format instead. periodt.
Running as unsnappy, or passing -d? Now we're decompressing. Same file rules as above (yes, "-" and stdin defaults still apply π
), and it goes from Snappy β or from the Snappy framing format, which it detects automatically β out to the standard output stream. Add -i and decompression errors and framing errors just get ignored, and processing keeps going like nothing happened. iconic, honestly.
β οΈ Real talk, this is a format limitation: if file isn't seekable while you're producing or decompressing unframed Snappy streams, the whole thing gets read into memory. In its entirety. All of it. π
π EXIT STATUS π
1β a decompression error happened (invalid or truncated Snappy block), or a framing error did (Stream identifier (0xFF) frame invalid, unknown reserved unskippable chunk ([0x02, 0x7F]) frame encountered, checksum mismatch).2β an I/O error happened. rip.3β you were compressing without-fand file is bigger than 4GiB. (The output itself is unaffected, but go peek at βBUGSβ below π)
π©Ί DIAGNOSTICS π©Ί
After compressing, you might see something like this:
data: 2048576 -> 1099105 (53.65%)
which means the file data was 2048576 bytes, and it got compressed down to 1099105 bytes, so the output is 53.65% the size. math ate, no cap π
π SEE ALSO π
The Snappy homepage: https://google.github.io/snappy/ β go look, bestie π¦
π CONFORMING TO π
The framed format, with MIME type βapplication/x-snappy-framedβ, version 2013-10-25: Snappy framing format description: https://github.com/google/snappy/blob/main/framing_format.txt.
The unframed format, as described in Snappy compressed format description: https://github.com/google/snappy/blob/main/format_description.txt, as provided by the upstream Fast Compressor/Decompressor Library (libsnappy, -lsnappy).
π BUGS π
okay so the largest representable unframed stream is of size 4GiB-1B (= 4Β·1024Β·1024Β·1024B-1B = 4294967295B). Go above that and the length stored in the header gets mangled β the stream might still be semantically correct, but it'll produce an incorrect (short) output when you decompress it. snappy warns you about this and exits 3. not a vibe.
On 32-bit systems, it is literally impossible to produce unframed streams from files larger than 4GiB-1B at all, thanks to an API limitation (βEXIT STATUS 2β). Also on 32-bit systems, the output size and compression ratio will be misrepresented if compression produces an unframed output larger than 4GiB-1B. And you can't decompress such files there either. rough out here π
Supposedly, compressors which produce checksums with inverted byte order exist in the wild. wild wild.
and that's the whole page, bestie!! this one's from snappy-tools 1-1, dated February 15, 2024 β mwah, go compress something ππ«Ά
π¦ where this page comes from
- debian trixie: snappy-tools 1-1 Β· 0BSD
- ubuntu noble: snappy-tools 1-1 Β· 0BSD
- ubuntu questing: snappy-tools 1-1
- π the page's license: 0BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms