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

前端 未结 7 748
时光说笑
时光说笑 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:47

    I think Sergei Tulentsevs idea is brilliant.

    However, if there is control over the server -- e.g. custom code can be deployed -- then it is a rather trivial operation (in the scheme of things :) to map/handle a request, extract the relevant portion of the ZIP archive, and send the data back in the HTTP stream.

    The request might look like:

    http://foo.bar/myfile.zip_a.jpeg
    

    Which would mean extract -- and return -- "a.jpeg" from "myfile.zip".

    (I intentionally chose this silly format so that browsers would likely choose "myfile.zip_a.jpeg" as the name in the download dialog when it appears.)

    Of course, how this is implemented depends on the server/language/framework and there may already be existing solutions that support a similar operation (but I know not).

    Happy coding.

提交回复
热议问题