Skip to content

Commit

Permalink
Merge pull request #2 from ryanlovett/patch-1
Browse files Browse the repository at this point in the history
Find compression type.
  • Loading branch information
arjan-s authored Jul 2, 2019
2 parents 981c2b8 + de64a6e commit 8dca8a2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ from flask import Response
@app.route('/package.zip', methods=['GET'], endpoint='zipball')
def zipball():
def generator():
z = zipstream.ZipFile(mode='w', compression=ZIP_DEFLATED)
z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)

z.write('/path/to/file')

Expand All @@ -107,7 +107,7 @@ def zipball():

@app.route('/package.zip', methods=['GET'], endpoint='zipball')
def zipball():
z = zipstream.ZipFile(mode='w', compression=ZIP_DEFLATED)
z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
z.write('/path/to/file')

response = Response(z, mimetype='application/zip')
Expand All @@ -119,7 +119,7 @@ def zipball():
@app.route('/package.zip', methods=['GET'], endpoint='zipball')
def zipball():
def generate_zip_with_manifest():
z = zipstream.ZipFile(mode='w', compression=ZIP_DEFLATED)
z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)

manifest = []
for filename in os.listdir('/path/to/files'):
Expand All @@ -142,7 +142,7 @@ def zipball():
from django.http import StreamingHttpResponse

def zipball(request):
z = zipstream.ZipFile(mode='w', compression=ZIP_DEFLATED)
z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
z.write('/path/to/file')

response = StreamingHttpResponse(z, content_type='application/zip')
Expand Down

0 comments on commit 8dca8a2

Please sign in to comment.