Description
ZipFly is a Python library that builds ZIP archives as a stream, so a large archive can be sent to a client while it is still being created. It is based on Python's standard zipfile module, but it writes to the destination as it goes instead of saving the whole archive to disk first. Data is written out in regular 32 KB chunks, which keeps memory use low. You describe the files to include as a list of paths, each with an optional name inside the archive, and a helper can build that list from a parent folder. Another helper predicts the final size of the archive before it is created, which is useful when a response needs a length in advance. The library can also stream a single very large binary file and can write to unseekable streams. It needs Python 3.6 or later and is installed with pip. The README includes examples for streaming several files from Django or Flask.…
Highlights
- Streams ZIP archives without writing them to disk first
- Writes data in 32 KB chunks to keep memory use low
- Predicts the final archive size before creating it
- Works with unseekable output streams
- Python 3.6 and later, installed with pip
Ratings & Reviews
No ratings yet
Be the first to rate Zipfly.
People also visit
Zipfly FAQ
What is ZipFly used for?
Building ZIP archives in Python that are sent to a client as they are created, such as large downloads from a web app.
How do I install ZipFly?
Run pip3 install zipfly. The README lists Python 3.6 or later as the requirement.
Does it save the archive to disk?
No. It writes the archive to the destination as it is built, although the zipfile deflater still buffers some data in memory.
Can it tell me the archive size before creating it?
Yes. The BufferPredictionSize helper computes the size of the resulting archive before it is created.
Is ZipFly open source?
Its source code is public on GitHub at sandes/zipfly.
What are the best Zipfly alternatives?
Popular alternatives to Zipfly include Laravel Zipstream, Smart Open and Down. See all Zipfly alternatives




