[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

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

Berlin Brown

1/14/2008 10:16:00 PM

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.
4 Answers

Diez B. Roggisch

1/14/2008 10:58:00 PM

0

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

Berlin Brown

1/14/2008 11:05:00 PM

0

On Jan 14, 5:58 pm, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> 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


Clearly, someone doesn't know python as well as he should. That is
good idea, thanks. So basically treat StringIO as the in memory
container to write the zip file data to.

John Machin

1/15/2008 9:29:00 AM

0

On Jan 15, 9:58 am, "Diez B. Roggisch" <de...@nospam.web.de> wrote:

> Module StringIO is your friend.

and cStringIO is your ....?




Neil Cerutti

1/15/2008 1:25:00 PM

0

On Jan 15, 2008 4:28 AM, John Machin <sjmachin@lexicon.net> wrote:
> On Jan 15, 9:58 am, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
>
> > Module StringIO is your friend.
>
> and cStringIO is your ....?

.... friend +1?
--
Neil Cerutti <mr.cerutti+python@gmail.com>