stream-inflate-0.0.9


توضیحات

Uncompress DEFLATE streams in pure Python (albeit compiled with Cython)
ویژگی مقدار
سیستم عامل -
نام فایل stream-inflate-0.0.9
نام stream-inflate
نسخه کتابخانه 0.0.9
نگهدارنده []
ایمیل نگهدارنده []
نویسنده -
ایمیل نویسنده Michal Charemza <michal@charemza.name>
آدرس صفحه اصلی -
آدرس اینترنتی https://pypi.org/project/stream-inflate/
مجوز -
# stream-inflate [![PyPI package](https://img.shields.io/pypi/v/stream-inflate?label=PyPI%20package)](https://pypi.org/project/stream-inflate/) [![Test suite](https://img.shields.io/github/actions/workflow/status/michalc/stream-inflate/test.yml?label=Test%20suite)](https://github.com/michalc/stream-inflate/actions/workflows/test.yml) [![Code coverage](https://img.shields.io/codecov/c/github/michalc/stream-inflate?label=Code%20coverage)](https://app.codecov.io/gh/michalc/stream-inflate) Uncompress Deflate and Deflate64 streams in pure Python (albeit compiled with Cython). ## Installation ```bash pip install stream-inflate ``` ## Usage To uncompress Deflate, use the `stream_inflate` function. ```python from stream_inflate import stream_inflate import httpx def compressed_chunks(): # Iterable that yields the bytes of a DEFLATE-compressed stream with httpx.stream('GET', 'https://www.example.com/my.txt') as r: yield from r.iter_raw(chunk_size=65536) for uncompressed_chunk in stream_inflate()[0](compressed_chunks()): print(uncompressed_chunk) ``` To uncompress Deflate64, use the `stream_inflate64` function. ```python for uncompressed_chunk in stream_inflate64()[0](compressed_chunks()): print(uncompressed_chunk) ``` For Deflate streams of unknown length where there may be other data _after_ the compressed part, the following pattern can be used to find how many bytes are not part of the compressed stream. ```python uncompressed_chunks, is_done, num_bytes_unconsumed = stream_inflate() it = iter(compressed_chunks()) while not is_done(): chunk = next(it) for uncompressed in uncompressed_chunks((chunk,)) print(uncompressed) print(num_bytes_unconsumed()) ``` This can be useful in certain ZIP files.


نیازمندی

مقدار نام
xtr coverage>=6.2;
xtr pytest>=6.2.5;
xtr pytest-cov>=3.0.0;
xtr Cython>=3.0.0;
xtr setuptools;
xtr build;


زبان مورد نیاز

مقدار نام
>=3.7.7 Python


نحوه نصب


نصب پکیج whl stream-inflate-0.0.9:

    pip install stream-inflate-0.0.9.whl


نصب پکیج tar.gz stream-inflate-0.0.9:

    pip install stream-inflate-0.0.9.tar.gz