Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
42 lines (32 sloc) 1.57 KB
This library was created by SpiderOak, Inc. and is released under the GPLv3.
SpiderOak zipstream module is a zip archive generator based on It was created to
generate a zip file on-the-fly for download in a (
application. This is beneficial for when you want to provide a downloadable
archive of a large collection of regular files, which would be infeasible to
generate the archive prior to downloading.
The archive is generated as an iterator of strings, which, when joined, form
the zip archive. For example, the following code snippet would write a zip
archive containing files from 'path' to a normal file:
zf = open('', 'wb')
for data in ZipStream(path):
Since recent versions of support returning iterators of strings to be
sent to the browser, to download a dynamically generated archive, you could
use something like this snippet:
def GET(self):
path = '/path/to/dir/of/files'
zip_filename = ''
web.header('Content-type' , 'application/zip')
web.header('Content-Disposition', 'attachment; filename="%s"' % (
return ZipStream(path)
If the zlib module is available, ZipStream can generate compressed zip
Contact the SpiderOak team at
And be sure to back up your files!