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

B

BerlinBrown

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.
 
D

Diez B. Roggisch

BerlinBrown said:
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
 
B

BerlinBrown

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top