Is it possible to download just part of a ZIP archive (e.g. one file)?

前端 未结 7 703
时光说笑
时光说笑 2020-12-14 17:51

I was wondering is there any way by which I can download only a part of a .rar or .zip file without downloading the whole file ? There is a zip file containing files A,B,C a

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 18:45

    Can you arrange for your file to appear in the back of the zip?

    Download 100k:

    $ curl -r -100000 https://www.keepassx.org/releases/2.0.2/KeePassX-2.0.2.zip -o tail.zip
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
    100   97k  100   97k    0     0  84739      0  0:00:01  0:00:01 --:--:-- 84817
    

    Check what files we did get:

    $ unzip -t tail.zip
      (please check that you have transferred or created the zipfile in the
      appropriate BINARY mode and that you have compiled UnZip properly)
    error [tail.zip]:  attempt to seek before beginning of zipfile
      (please check that you have transferred or created the zipfile in the
      appropriate BINARY mode and that you have compiled UnZip properly)
    error [tail.zip]:  attempt to seek before beginning of zipfile
      (please check that you have transferred or created the zipfile in the
      appropriate BINARY mode and that you have compiled UnZip properly)
    error [tail.zip]:  attempt to seek before beginning of zipfile
      (please check that you have transferred or created the zipfile in the
      appropriate BINARY mode and that you have compiled UnZip properly)
    error [tail.zip]:  attempt to seek before beginning of zipfile
      (please check that you have transferred or created the zipfile in the
      appropriate BINARY mode and that you have compiled UnZip properly)
        testing: KeePassX-2.0.2/share/translations/keepassx_uk.qm   OK
        testing: KeePassX-2.0.2/share/translations/keepassx_zh_CN.qm   OK
        testing: KeePassX-2.0.2/share/translations/keepassx_zh_TW.qm   OK
        testing: KeePassX-2.0.2/zlib1.dll   OK
    At least one error was detected in tail.zip.
    

    Then extract the last file:

    $ unzip tail.zip KeePassX-2.0.2/zlib1.dll
    Archive:  tail.zip
    error [tail.zip]:  missing 7751495 bytes in zipfile
      (attempting to process anyway)
      inflating: KeePassX-2.0.2/zlib1.dll  
    

提交回复
热议问题