wire / wire-format / gzip-format
A gzip file consists of a 10-byte header, optional original filename/comment/extra fields, the DEFLATE-compressed payload, and an 8-byte trailer (CRC-32 of the uncompressed data + uncompressed size mod 2^32).
aka: gzip file format (RFC 1952)
spec: RFC 1952
A gzip file consists of a 10-byte header, optional original filename/comment/extra fields, the DEFLATE-compressed payload, and an 8-byte trailer (CRC-32 of the uncompressed data + uncompressed size mod 2^32).
| field | size | meaning |
|---|---|---|
| Magic | 2 bytes | 0x1F 0x8B. |
| CM | 1 byte | Compression method: 8 = DEFLATE. |
| FLG | 1 byte | Flags: FTEXT, FHCRC, FEXTRA, FNAME, FCOMMENT. |
| MTIME | 4 bytes | Modification time (Unix seconds), or 0 if unknown. |
| XFL | 1 byte | Extra flags: 2 = compressor used max, 4 = fastest. |
| OS | 1 byte | OS: 0 FAT, 3 Unix, 7 Macintosh, 11 Windows NT, 255 unknown. |
| FNAME | variable | Original filename, NUL-terminated (if FLG.FNAME set). |
| FCOMMENT | variable | Comment, NUL-terminated (if FLG.FCOMMENT set). |
| FHCRC | 2 bytes | CRC-16 of header (if FLG.FHCRC set). |
| Compressed data | variable | DEFLATE bitstream. |
| CRC-32 | 4 bytes | CRC-32 of the uncompressed data (little-endian). |
| ISIZE | 4 bytes | Uncompressed size mod 2^32 (little-endian). |
example:
1f 8b 08 00 00 00 00 00 00 ff 03 00 00 00 00 00 00 00 00 00
Minimal empty gzip stream (10-byte header + empty DEFLATE block + 8-byte trailer)
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/gzip-format
or /wire-format/gzip-format.json