Hasty Briefsbeta

Bilingual

Gzpeek: Tool to Parse Gzip Metadata

3 days ago
  • #gzip
  • #metadata
  • #compression
  • Gzip streams contain metadata including the operating system that performed the compression.
  • The gzip header includes a byte identifying the compressor's OS (e.g., 0 for Windows, 3 for Unix).
  • Different tools and libraries set the OS flag differently, making it unreliable but potentially useful as a hint.
  • The modification time in the metadata is a Unix timestamp, but many implementations set it to 0.
  • The FTEXT flag indicates if data is ASCII text, but it's rarely used and often set to 0.
  • An extra flag (XFL) indicates compression effort (e.g., 2 for max compression, 4 for fastest).
  • Optional fields include the original filename and a comment, though many tools don't set them.
  • gzpeek is a command-line tool written in Zig to inspect gzip metadata, extracting OS, filename, modification time, etc.