【问题标题】:ZIP files in the wild that don't use DEFLATE?不使用 DEFLATE 的野外 ZIP 文件?
【发布时间】:2021-08-07 05:47:02
【问题描述】:

我正在 Python 中制作(流式传输)解压缩函数。 ZIP 文件可以使用多种压缩算法,但最常见的是 DEFLATE 根据https://en.wikipedia.org/wiki/ZIP_(file_format)

是否有任何不使用 DEFLATE 的 ZIP 文件“广泛存在”的示例(例如,在提供下载的网站上)?既是为了测试,也是为了弄清楚是否值得添加这种支持。

【问题讨论】:

    标签: 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 年中)。但我也没有看起来很努力。

      【讨论】:

        猜你喜欢
        • 2018-11-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-02-21
        • 2018-12-10
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多