COMPRESSION_TOOL(1) General Commands Manual COMPRESSION_TOOL(1)

compression_toolencode/decode files using the Compression library.

compression_tool compression_tool -encode | -decode [-a algorithm] [-A algorithm] [-i input_file] [-o output_file] [-v] [-h]

compression_tool encodes (compresses), or decodes (uncompresses) files using the Compression library.

Encode (compress) the input
Decode (uncompress) the input
Set the compression algorithm, valid options are zlib, lzma, lzfse, lz4, lz4_raw. Default is lzfse.
- zlib      raw DEFLATE payload, as defined in IETF RFC 1951, encoder is zlib level 5,
- lzma      LZMA2 payload inside a XZ container, encoder is LZMA2 preset 6,
- lz4       raw LZ4 payload inside a simple frame format (described in compression.h),
- lz4_raw   raw LZ4 payload,
- lzfse     LZFSE payload.
Enable block compression, and set compression algorithm, valid options are zlib, lzma, lzfse, lz4. Default is lzfse.
Set block size for block compression. The integer value can be followed by m or k or b.
Set the number of worker threads to use for block compression/decompression. Default is the number of logical threads on the machine.
Input file. If omitted, read from standard input.
Output file. If omitted, write to standard output.
Increase verbosity. Default is silent operation.
Print usage and exit.

The file starts with a 4-byte header 'p','b','z',<algo>, where <algo> indicates the algorithm used to compress data. The header is followed by the 64-bit block size in bytes. Then for each block, we have 64-bit uncompressed size (will batch the block size, except possibly for the last block), 64-bit compressed size, and the compressed payload. If both uncompressed and compressed sizes for a block are equal, the payload is stored uncompressed. All 64-bit values are stored big-endian. Valid values for <algo> are: 'z' for zlib, 'x' for lzma, '4' for lz4, and 'e' for lzfse.

January 4, 2023 macOS