【问题标题】:ZIP files in the wild that don't use DEFLATE?不使用 DEFLATE 的野外 ZIP 文件?
【发布时间】:2021-08-07 05:47:02
【问题描述】:
【问题讨论】:
标签:
python
zip
compression
zlib
deflate
【解决方案1】:
通常会在 zip 存档(尤其是已经压缩的文件,例如 PNG、JPG)中找到简单存储的文件,因为放缩会使它们变得更大:
$ 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
然后
$ 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%
您可能还会发现使用 implode algorithm 的非常旧的 zip 文件,但我认为它不会增加实施它的价值。
【解决方案2】:
我了解到 Windows 资源管理器将使用 Deflate64 为大于 2 GB 的条目创建 zip 文件。 7-Zip 可以根据要求使用 Deflate64、BZip2、LZMA 或 PPMd 生成 zip 文件。
我在野外没有发现任何未储存或放气的东西(至少在过去 30 年中)。但我也没有看起来很努力。