allanlei / python-zipstream

Like Python's ZipFile module, except it works as a generator that provides the file in many small chunks.
GNU General Public License v3.0
128 stars 34 forks source link

Add file objects rather than paths? #14

Open pkkid opened 8 years ago

pkkid commented 8 years ago

Is there a way to add file-like objects rather than file paths? Something like:

handle = open('foobar', 'r')
z = zipstream.ZipFile(mode='w', compression=ZIP_DEFLATED)
z.write(handle)
luckydonald commented 8 years ago

This would be great for django too, when pulling files from the database.

vstoykov commented 7 years ago

There is PR started for this #2 but need to be rebased.

pgruenbacher commented 6 years ago

write_iter('arcname', fileobj) will work if the fileobject is iterable. This works great for streaming zip files withing other streaming zip files too!