Append zip files together, just get the binary data (in memory)

Diez B. Roggisch deets at nospam.web.de
Mon Jan 14 17:58:24 EST 2008


BerlinBrown schrieb:
> Is it possible to just build the binary content of a zip file.  I want
> to create the content in memory (e.g. return binary data) and then get
> those byte strings representing the zip file?  Is that possible?
> 
> Or could I possibly override functions in the zip class.
> 
> 1. Create a zip file object (e.g. dont actually create the file).
> 2. Append stuff to the zip file (e.g. a file)
> 3. Zip that content into memory (but still not touching the
> filesystem)
> 4. Extract those byte strings for (an array?) later use.
> 
> My goal is to concatenate multiple zip files into another binary file.


Module StringIO is your friend.

Diez



More information about the Python-list mailing list