Hasty Briefsbeta

Peeking Inside Gigantic Zips with Only Kilobytes

a day ago
  • #ZIP
  • #Compression
  • #HTTP
  • ZIP files have a tiny index at the end called the End of Central Directory (EOCD).
  • The EOCD contains metadata like the Central Directory's location, size, and number of entries.
  • The Central Directory (CD) acts as a table of contents, listing filenames, sizes, and offsets to Local File Headers (LFH).
  • Local File Headers (LFH) store per-file metadata and compressed data.
  • Using HTTP Range requests, you can fetch only the EOCD and CD to inspect a ZIP's contents without downloading the entire file.
  • This method is efficient for large ZIPs, including ZIP64 files with 64-bit fields.
  • The browser demo demonstrates fetching ZIP metadata in just a few HTTP requests.
  • Servers must support HTTP Range and expose headers like Content-Range for this to work.