[Python-Dev] zipfile.py

James C. Ahlstrom jim@interet.com
Thu, 30 Dec 1999 09:21:36 -0500


Finn Bock wrote:
> 
> James C. Ahlstrom wrote:
> 
> >  ftp://ftp.interet.com/pub/pylib.html
> 
> I feel that it smell a bit too much like a tool and too little like an general
> programming api.

It was meant to be an API except for writepy(), which is clearly a tool.
 
> - It can only add disk files. The ability to write data to a zip entry through
>   a file-like object or from a string would make it more like an API, IMHO

I could add a method
     writestr(self, string, year, month, day, hour, minute, second, ...)
There are a lot of fields required which usually come from the file.

> -  Some kind of access to the TOC entry fields (date, size, compressed
>   size etc) also seems like a nice feature.

This access is provided directly by self.TOC, and the fields are
documented.

> - The data for an entry must be available in memory. Could be a problem
>   for huge files, but most like not in practical use.

I agree, but adding loops will make it slower.  What do others think?
 
> I admit that I am fond of the api from java.util.zip.ZipFile and
> java.util.zip.ZipOutputStream.

I don't know this API.  If writestr() is not sufficient, what
API would you like?

JimA