Deron Meranda
deron.meranda at gmail.com
Mon Mar 6 20:47:05 EST 2006
On 3/6/06, jarrod roberson <jarrod.roberson at gmail.com> wrote: > I saw a post recommending to use ZipFile, ZipFile won't work, it needs > .tell(). It updates all the zip headers after the fact. > I found something called zipstream.py, but alas, it does the same thing! I usually deal with formats other than ZIP, so I probably can't solve your problem. But it should be possible to write a streamable ZIP output filter if you can't find one. Have a look at the specification here: http://www.pkware.com/business_and_developers/developer/appnote/ I think that, in combination with the python "struct" module and os.path.walk(), should get you pretty close, especially if you ignore compression (although adding on deflate compression should be a pretty easy thing, as python's deflate is streamable). BTW, this is really more of a general-purpose Python question than a mod_python one. Perhaps you might get a wider range of responses on a more general mailing list. Although once you get a streamable ZIP, we can certainly assist getting it into a mod_python handler. (BTW, Graham, using the tell() file method means that it is not streamable ... e.g., not suitable for very large archives. Because it has to "render" the whole archive, either in memory or on disk.) -- Deron Meranda
|