wire / wire-format / brotli-format
Brotli is a compression format developed by Google, optimized for web content. A Brotli stream: window size (WBITS), then meta-blocks. Each meta-block: ISLAST (1 bit), ISUNCOMPRESSED (1 bit), optional data length (MLEN), then block data (literals with context modeling + backward references with a large window up to 16MB).
aka: Brotli compressed data format
spec: RFC 7932
Brotli is a compression format developed by Google, optimized for web content. A Brotli stream: window size (WBITS), then meta-blocks. Each meta-block: ISLAST (1 bit), ISUNCOMPRESSED (1 bit), optional data length (MLEN), then block data (literals with context modeling + backward references with a large window up to 16MB).
| field | size | meaning |
|---|---|---|
| WBITS | variable | Window size: 0-15 (16-17) or 16-30 (1MB-16MB window). Encoded as a variable-length code. |
| ISLAST | 1 bit | 1 if this is the last meta-block. |
| ISUNCOMPRESSED | 1 bit | 1 if the meta-block is stored uncompressed. |
| MNIBBLES | 2 bits | Number of nibbles for MLEN (0 = no MLEN, 1-3 = 1-3 nibbles). |
| MLEN | variable | Meta-block data length (if MNIBBLES > 0). |
| Block data | variable | Literals (context-dependent Huffman) + backward references (distance + length, with a 120-entry static dictionary for common web terms). |
| Trailer | 0 bits | No explicit trailer; the stream ends with ISLAST=1. |
example:
06 00
Brotli: WBITS 16 (1MB window), empty stream (ISLAST=1, ISUNCOMPRESSED=0, MLEN=0)
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/brotli-format
or /wire-format/brotli-format.json