wire / wire-format / gzip-format

gzip file format (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).

wire-format kind wire-format status standard verification verified tier B wire-format@1

aka: gzip file format (RFC 1952)

wire format

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).

fieldsizemeaning
Magic2 bytes0x1F 0x8B.
CM1 byteCompression method: 8 = DEFLATE.
FLG1 byteFlags: FTEXT, FHCRC, FEXTRA, FNAME, FCOMMENT.
MTIME4 bytesModification time (Unix seconds), or 0 if unknown.
XFL1 byteExtra flags: 2 = compressor used max, 4 = fastest.
OS1 byteOS: 0 FAT, 3 Unix, 7 Macintosh, 11 Windows NT, 255 unknown.
FNAMEvariableOriginal filename, NUL-terminated (if FLG.FNAME set).
FCOMMENTvariableComment, NUL-terminated (if FLG.FCOMMENT set).
FHCRC2 bytesCRC-16 of header (if FLG.FHCRC set).
Compressed datavariableDEFLATE bitstream.
CRC-324 bytesCRC-32 of the uncompressed data (little-endian).
ISIZE4 bytesUncompressed 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)


provenance

agent: curl -H 'accept: application/json' wire.phall.io/wire-format/gzip-format or /wire-format/gzip-format.json