# gzip format

Byte order: Little-endian

    Offset   Length   Contents
      0      2 bytes  magic header  0x1f, 0x8b (\037 \213)
      2      1 byte   compression method
                         0: store (copied)
                         1: compress
                         2: pack
                         3: lzh
                         4..7: reserved
                         8: deflate
      3      1 byte   flags
                         bit 0 set: file probably ascii text
                         bit 1 set: continuation of multi-part gzip file, part number present
                         bit 2 set: extra field present
                         bit 3 set: original file name present
                         bit 4 set: file comment present
                         bit 5 set: file is encrypted, encryption header present
                         bit 6,7:   reserved
      4      4 bytes  file modification time in Unix format
      8      1 byte   extra flags (depend on compression method)
      9      1 byte   OS type
    [
             2 bytes  optional part number (second part=1)
    ]?
    [
             2 bytes  optional extra field length (e)
            (e)bytes  optional extra field
    ]?
    [
               bytes  optional original file name, zero terminated
    ]?
    [
               bytes  optional file comment, zero terminated
    ]?
    [
            12 bytes  optional encryption header
    ]?
               bytes  compressed data
             4 bytes  crc32
             4 bytes  uncompressed input size modulo 2^32

OS type:

ID | OS
--- | ---
0x00 | FAT filesystem (MS-DOS, OS/2, NT/Win32)
0x01 | Amiga
0x02 | VMS (or OpenVMS)
0x03 | Unix
0x04 | VM/CMS
0x05 | Atari TOS
0x06 | HPFS filesystem (OS/2, NT)
0x07 | Macintosh
0x08 | Z-System
0x09 | CP/M
0x0a | TOPS-20
0x0b | NTFS filesystem (NT)
0x0c | QDOS
0x0d | Acorn RISCOS
0xff | unknown