[Python-Dev] Keyword meanings [was: Accept just PEP-0426]
dholth at gmail.com
Thu Dec 6 16:23:20 CET 2012
On Thu, Dec 6, 2012 at 9:58 AM, Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:
> Daniel Holth <dholth <at> gmail.com> writes:
> > The wheel implementation makes sure all the metadata (the .dist-info
> > is at the end of the .zip archive. It's possible to read the metadata
> with a
> > single HTTP partial request for the end of the archive without
> downloading the
> > entire archive.
> Sounds good, but can you point to any example code which does this? As I
> understand it, for .zip files you have to read the last part of the file
> to get a
> pointer to the directory, then read that to find where each file in the
> is, then seek to a specific position to read the file contents.
You have to make a maximum of 3 requests: one for the directory pointer,
one for the directory, and one for the file you want. It's not particularly
difficult to make an HTTP-backed seekable file object to pass to ZipFile()
for this purpose but I don't have an example. Normally the last few k of
the file will contain all 3 pieces. 8k or 16k would be a good guess.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev