Skip to main content

A AIOHTTP response class streaming a directory as ZIP archive

Project description

AIOHTTP ZIP Response

Versions PyPI Codecov License

A AIOHTTP response class streaming the contents of a directory as a ZIP archive. Thanks to stream-zip, this works without storing the entire ZIP in memory or disk.

Generally, this package is meant to complement the existing aiohttp.web.FileResponse class which can be used to stream the contents of a single file.

Installation

pip install aiohttp-zip-response

Usage

from aiohttp import web
from aiohttp_zip_response import ZipResponse


async def handle_zip(request):
    return ZipResponse('path/to/directory')


app = web.Application()
app.router.add_get('/zip', handle_zip)
web.run_app(app)

Caveats

  • The Content-Length header is not set because the size of the ZIP archive is not known in advance. This means clients such as browsers cannot display a download progress bar.
  • This package currently doesn't support streaming of symbolic links to directories.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiohttp_zip_response-2.1.0.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

aiohttp_zip_response-2.1.0-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page