Is it possible to download just part of a ZIP arch

2020-02-09 01:42发布

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 and D. I only need A. Can I somehow, tweak the download to download only A or if possible extract the file in the server itself and get A only ?

标签: zip rar
7条回答
孤傲高冷的网名
2楼-- · 2020-02-09 02:26

In a way, yes, you can.

ZIP file format says that there's a "central directory". Basically, this is a table that stores what files are in the archive and what offsets do they have.

So, using Content-Range you could download part of file from the end (central directory is the last thing in zip file) and try to identify central directory in it. If you succeed then you know file list and offsets, so you can proceed and get those chunks separately and decompress them yourself.

This approach is quite error-prone and is not guaranteed to work. But so is hacking in general :-)

Another possible approach would be to build a custom server for that (see @pst's answer for more details).

查看更多
登录 后发表回答