Python library for generating ZIP files on-the-fly with ZIP file size information.
Project description
# ZipStreamer
ZipStreamer is a Python library for generating ZIP files on-the-fly with ZIP
file size information.
This library was implemented using logic from Python's `zipfile` library and
Golang's `archive/zip` library.
```python
z = ZipStream(files=[
ZipFile('file.txt', 4, lambda: StringIO('test'), None, None),
ZipFile('emptydir/', None, None, None, None),
ZipFile('dir/remote.txt', remote_file_size, get_remote_file, None, None),
])
size = z.size()
res = Response(z.generate(), mimetype='application/zip')
res.headers['Content-Length'] = str(size)
```
## Installation
```
pip install zipstreamer
```
## Examples
```
pip install flask requests
PYTHONPATH=. FLASK_APP=examples/flask_example.py flask run
```
## Testing
```
pipenv install --dev --skip-lock
pipenv run nosetests
```
Testing multiple versions:
```
pip install pyenv tox tox-pyenv
pyenv install 2.7.14
pyenv install 3.4.8
pyenv install 3.5.5
pyenv install 3.6.4
pyenv install 3.7-dev
pyenv local 2.7.14 3.4.8 3.5.5 3.6.4 3.7-dev
tox
```
ZipStreamer is a Python library for generating ZIP files on-the-fly with ZIP
file size information.
This library was implemented using logic from Python's `zipfile` library and
Golang's `archive/zip` library.
```python
z = ZipStream(files=[
ZipFile('file.txt', 4, lambda: StringIO('test'), None, None),
ZipFile('emptydir/', None, None, None, None),
ZipFile('dir/remote.txt', remote_file_size, get_remote_file, None, None),
])
size = z.size()
res = Response(z.generate(), mimetype='application/zip')
res.headers['Content-Length'] = str(size)
```
## Installation
```
pip install zipstreamer
```
## Examples
```
pip install flask requests
PYTHONPATH=. FLASK_APP=examples/flask_example.py flask run
```
## Testing
```
pipenv install --dev --skip-lock
pipenv run nosetests
```
Testing multiple versions:
```
pip install pyenv tox tox-pyenv
pyenv install 2.7.14
pyenv install 3.4.8
pyenv install 3.5.5
pyenv install 3.6.4
pyenv install 3.7-dev
pyenv local 2.7.14 3.4.8 3.5.5 3.6.4 3.7-dev
tox
```
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
zipstreamer-0.1.3.tar.gz
(5.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zipstreamer-0.1.3.tar.gz.
File metadata
- Download URL: zipstreamer-0.1.3.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e170c5d89325fbb4bda2b7be1c14da297e774c23777d3575a722298ff8afae2c
|
|
| MD5 |
5c41015edc54561e634c6c5f99143958
|
|
| BLAKE2b-256 |
f82ff7f236c12d69e9abba1eef5154be7816de9c3cb5c4d5f521628c97fda1b2
|
File details
Details for the file zipstreamer-0.1.3-py2.py3-none-any.whl.
File metadata
- Download URL: zipstreamer-0.1.3-py2.py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3958dc9d44a7634d010b365bc33c0fee39faeedca6818ba16be38e69598c062a
|
|
| MD5 |
dcb4ef0fb3dab59b44d6bf2403279a3a
|
|
| BLAKE2b-256 |
96fd528dec8fed7f35126074858dcc52533b9465878cf12b5bae5bfa6922e36b
|