StreamZipper
This package allows you to collect several streams of files and then turn several streams into one single zipped stream
This can be usefull if you want to serve multiple files from a file server as a single zip file. but you dont to load all files in memory
installation
pip install stream-zipper
Usage
from stream_zipper import ZipStream
zip_stream = ZipStream()
zip_stream.prepare_stream(file_stream_1)
zip_stream.prepare_stream(file_stream_2)
zip_stream.prepare_stream(file_stream_3)
zipped_stream = zip_stream.stream()
the first argument is always the stream of the file. all other arguments must be passed as keyword argument (key=val)
in the method prepare_stream you can also specify the following kwargs :
- file_name: the name of the file (in the zip)
- zip_info: Can be used to pass a ZipInfo object. (makes other variables useless)
- file_size: size of the file, if set to 0 or not set then it will find the file_length for you
- crc: crc code of the file, if set to 0 or not set then it will find the crc for you
When you provide the crc or file_size it will check the provided value against the data it processed in the stream of that file If these values do not match then an exception will be thrown.
Notes
If you do not know the file_size or crc code then that file will have to be streamed twice to get these variables
if you do know the crc code of the files and you know the file_size then it will only call the stream once
it will check per file if it needs to get these values. so it is possible that only some files/streams have the crc and file_size variables.
from stream_zipper import ZipStream
zip_stream = ZipStream()
zip_stream.prepare_stream(file_stream_1) # no crc or file_size. calls the stream 2 times
zip_stream.prepare_stream(file_stream_2, file_size=100) # no crc calls the stream 2 times
zip_stream.prepare_stream(file_stream_3, crc="CRC-CODE") # no file_size calls the stream 2 times
zip_stream.prepare_stream(file_stream_4, file_size=100, crc="CRC-CODE") # both file_size and crc present will call stream 1 time
zipped_stream = zip_stream.stream() # total streams called 7
Metadata
Release files for stream-zipper 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stream-zipper-1.0.1.tar.gz | 5.5 kB | Without provenance | Details for stream-zipper-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stream_zipper-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for stream_zipper-1.0.1-py3-none-any.whl |
Total release size: 12.1 kB
Release files / stream-zipper-1.0.1.tar.gz
| Download URL | stream-zipper-1.0.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7077eac2337fb6686c93f16ab5d8f59111bd79b989d7d60ae2d8f2533ee273a1
|
|
BLAKE2b-256 checksum How to use checksums |
41f5c42b1e4dc18c680de42ef7d87098a76cd8f6b01d9beb7233589dafdf6a70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.6
|
Release files / stream_zipper-1.0.1-py3-none-any.whl
| Download URL | stream_zipper-1.0.1-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4702aa23043460d111eb260f9dc84c9a2f994c2b4f6baddfe3646be215d4b7c2
|
|
BLAKE2b-256 checksum How to use checksums |
20cea9ef93b14e9d0efbe5b973a1e6d4aba77fc9bb38aa30e68b70e4829ab73f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.6
|
Security for stream-zipper 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.