4 ms·
> A ZIP file is just a container for .gz files That doesn't sound right.
by jwilk 5y ago
> A ZIP file is just a container for .gz files
That doesn't sound right.
- greyface- 5y agoBoth PKZIP and gzip use DEFLATE: https://en.wikipedia.org/wiki/Deflate https://en.wikipedia.org/wiki/Deflate
- jl6 5y agoYeah, a gzip file is itself a container for a DEFLATE stream. Gzip files can contain metadata such as timestamps, and comments.
- zenexer 5y agoGZIP (.gz) and PKZIP (.zip) are both containers for DEFLATE. GZIP is barely a container with minimal metadata, whereas PKZIP supports quite a bit of metadata. Although you can’t quite concatenate GZIP streams to get a PKZIP file, it’s pretty close—if I recall correctly, you just chop off the GZIP header.
- zenexer 5y agoI'm past the edit period, but: > if I recall correctly, you just chop off the GZIP header. ...to get the raw DEFLATE stream, that is. You still need to attach any necessary metadata for PKZIP, which Max mentions. Their approach for converting between the two is pretty clever: it's so elegant and simple that it seems obvious, but I never would have thought of it. Very nifty, @max_k!