@@ -15,7 +15,7 @@ archive containing files from 'path' to a normal file:
1515
1616``` python
1717zf = open (' zipfile.zip' , ' wb' )
18- for data in ZipStream (path):
18+ for data in ZipFile (path):
1919 zf.write(data)
2020zf.close()
2121```
@@ -31,10 +31,10 @@ def GET(self):
3131 web.header(' Content-type' , ' application/zip' )
3232 web.header(' Content-Disposition' , ' attachment; filename="%s "' % (
3333 zip_filename,))
34- return ZipStream (path)
34+ return ZipFile (path)
3535```
3636
37- If the zlib module is available, ZipStream can generate compressed zip
37+ If the zlib module is available, ZipFile can generate compressed zip
3838archives.
3939
4040## Requirements
@@ -51,7 +51,7 @@ from flask import Response
5151@app.route (' /package.zip' , methods = [' GET' ], endpoint = ' zipball' )
5252def zipball ():
5353 def generator ():
54- z = ZipStream (mode = ' w' , compression = ZIP_DEFLATED )
54+ z = ZipFile (mode = ' w' , compression = ZIP_DEFLATED )
5555
5656 z.write(' /path/to/file' )
5757
@@ -66,7 +66,7 @@ def zipball():
6666
6767@app.route (' /package.zip' , methods = [' GET' ], endpoint = ' zipball' )
6868def zipball ():
69- z = ZipStream (mode = ' w' , compression = ZIP_DEFLATED )
69+ z = ZipFile (mode = ' w' , compression = ZIP_DEFLATED )
7070 z.write(' /path/to/file' )
7171
7272 response = Response(z, mimetype = ' application/zip' )
@@ -80,7 +80,7 @@ def zipball():
8080from django.http import StreamingHttpResponse
8181
8282def zipball (request ):
83- z = ZipStream (mode = ' w' , compression = ZIP_DEFLATED )
83+ z = ZipFile (mode = ' w' , compression = ZIP_DEFLATED )
8484 z.write(' /path/to/file' )
8585
8686 response = StreamingHttpResponse(z, mimetype = ' application/zip' )
@@ -97,5 +97,5 @@ def GET(self):
9797 web.header(' Content-type' , ' application/zip' )
9898 web.header(' Content-Disposition' , ' attachment; filename="%s "' % (
9999 zip_filename,))
100- return ZipStream (path)
100+ return ZipFile (path)
101101```
0 commit comments