std/compression
Compressed bytes: DEFLATE (RFC 1951) with deflated and inflated, gzip (RFC 1952) around it with gzipped and
gunzipped, and the crc32 gzip checks a member with. What a package archive of the registry is compressed with
(docs/design/RELEASE.md section 7.2), and what an HTTP body with Content-Encoding: gzip is.
Ordinary TorbScript over List<UInt8>, with no native. Inflating reads every stream the format allows - stored,
fixed and dynamic blocks, and gzip members one after the other. Deflating is deterministic and simple: one block
of the fixed codes, with a greedy match search over the last 32 KiB. It compresses text to roughly half, where zlib's
dynamic codes get to a third; what it writes is the same for the same bytes on every machine, which is what a
reproducible archive needs, and any inflater reads it.
Modules
std/compression/crc[crc32]: the checksum of gzip, zip and PNG.std/compression/deflate[deflated]: DEFLATE written (RFC 1951) as one block of the fixed codes.std/compression/error[CompressionError]: what reading compressed bytes fails with.std/compression/gzip[gzipped] and [gunzipped]: gzip members (RFC 1952) around DEFLATE.std/compression/inflate[inflated]: DEFLATE read back (RFC 1951), after Mark Adler'spuff.c- canonical Huffman codes decoded one bit at a time, which is short and exact rather than fast.
Everything
- type
CompressionErrorCompressed bytes that break their format: what is wrong, and the byte of the input where it was found. - extend
CompressionError with From<ReadError>A read ofstd/binarythat ran out of compressed bytes. - fn
crc32The CRC-32 of ISO 3309 and ITU-T V.42 - the reflected polynomial0xEDB88320- ofbytes. - fn
deflatedbytesas a raw DEFLATE stream: one final block of the fixed Huffman codes. - fn
gunzippedWhat every gzip member ofbytesholds, one after the other. - fn
gzippedbytesas one gzip member, with nothing in its header that depends on the machine or the moment: no file name, no time, the operating system "unknown". - fn
inflatedEverything a raw DEFLATE stream holds, which has to end with its last block.