Michal Charemza
Michal Charemza

Reputation: 27012

ZIP files in the wild that don't use DEFLATE?

I'm making a (streaming) unZIP function in Python. ZIP files can use a range of compression algorithms, but the most common is DEFLATE according to https://en.wikipedia.org/wiki/ZIP_(file_format)

Are there any examples "in the wild" of ZIP files that don't use DEFLATE (say, on sites that offer downloads)? Both for testing, but also, I'm trying to work out whether it's worth adding this support.

Upvotes: 2

Views: 687

Answers (2)

Mark Adler
Mark Adler

Reputation: 112239

I have read that Windows Explorer will create zip files using Deflate64 for entries greater than 2 GB. 7-Zip can, on request, generate zip files using Deflate64, BZip2, LZMA, or PPMd.

I have not found anything in the wild that is not stored or deflated (at least in the last 30 years). But I haven't looked very hard either.

Upvotes: 2

Selcuk
Selcuk

Reputation: 59184

It is common to find files in zip archives (especially already compressed files such as PNG, JPG) that were simply stored because deflate would have made them bigger:

$ zip -v test.zip test.jpg test.txt

  adding: test.jpg  (in=21520) (out=21520) (stored 0%)
  adding: test.txt  (in=14113) (out=3827) (deflated 73%)
total bytes=35633, compressed=25347 -> 29% savings

then

$ unzip -Z test.zip

Archive:  test.zip
Zip file size: 25657 bytes, number of entries: 2
-rw-r--r--  3.0 unx    21520 bx stor 21-May-18 11:03 test.jpg
-rw-r--r--  3.0 unx    14113 tx defN 21-May-18 11:10 test.txt
2 files, 35633 bytes uncompressed, 25347 bytes compressed:  28.9%

You might also find very old zip files that used the implode algorithm but I don't think it would add value to implement it.

Upvotes: 2

Related Questions