bz3 compress and decompress
Project description
✨ python-bz3 ✨
The python binding for bzip3
install
pip install bzip3
Usage
from bz3 import compress_file, decompress_file, test_file, compress, decompress
import bz3
with open("test_inp.txt", "rb") as inp, open("compressed.bz3", "wb") as out:
compress_file(inp, out, 1000 * 1000)
with open("compressed.bz3", "rb") as inp:
test_file(inp, True)
with open("compressed.bz3", "rb") as inp, open("output.txt", "wb") as out:
decompress_file(inp, out)
print(decompress(compress(b"12121")))
with bz3.open("test.bz3", "wt", encoding="utf-8") as f:
f.write("test data")
with bz3.open("test.bz3", "rt", encoding="utf-8") as f:
print(f.read())
- use
BZ3_USE_CFFI
env var to specify a backend
Public functions
from typing import IO, Optional
def compress_file(input: IO, output: IO, block_size: int) -> None: ...
def decompress_file(input: IO, output: IO) -> None: ...
def test_file(input: IO, should_raise: bool = ...) -> bool: ...
class BZ3File:
def __init__(self, filename, mode: str = ..., block_size: int = ...) -> None: ...
def close(self) -> None: ...
@property
def closed(self): ...
def fileno(self): ...
def seekable(self): ...
def readable(self): ...
def writable(self): ...
def peek(self, n: int = ...): ...
def read(self, size: int = ...): ...
def read1(self, size: int = ...): ...
def readinto(self, b): ...
def readline(self, size: int = ...): ...
def readlines(self, size: int = ...): ...
def write(self, data): ...
def writelines(self, seq): ...
def seek(self, offset, whence=...): ...
def tell(self): ...
def open(filename, mode: str = ..., block_size: int = ..., encoding: str = ..., errors: str = ..., newline: str = ...) -> BZ3File: ...
def compress(data: bytes, block_size: int = ...) -> bytes: ...
def decompress(data: bytes) -> bytes: ...
def libversion() -> str: ... # Get bzip3 version
def bound(in: int) -> int: ... # Return the recommended size of the output buffer for the compression functions.
# High-level api
# Compress a block of data into out buffer, zerocopy, both parameters accept objects which implements buffer-protocol.
# out must be writabel, size of out must be at least equal to bound(len(inp))
def compress_into(inp: Union[bytes, bytearray], out: bytearray) -> int: ...
# Decompress a block of data into out buffer, zerocopy
def decompress_into(inp: Union[bytes, bytearray], out: bytearray) -> int: ...
- Note, high-level api won't work with low-level api, see this
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bzip3-0.0.8.tar.gz
(186.6 kB
view hashes)
Built Distributions
bzip3-0.0.8-cp311-cp311-win_amd64.whl
(285.9 kB
view hashes)
bzip3-0.0.8-cp310-cp310-win_amd64.whl
(287.0 kB
view hashes)
bzip3-0.0.8-cp39-cp39-win_amd64.whl
(287.8 kB
view hashes)
bzip3-0.0.8-cp38-cp38-win_amd64.whl
(288.2 kB
view hashes)
bzip3-0.0.8-cp37-cp37m-win_amd64.whl
(286.8 kB
view hashes)
Close
Hashes for bzip3-0.0.8-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b93a54a67edfe6bb498dd3aa281e768d3d42104c6def4afb602b2b3d06751c5 |
|
MD5 | 00cbc8d46869b712827255fef60061e7 |
|
BLAKE2b-256 | 81588cac94110990a185fadf3d4cb1b85ecc79f7679275c00bede73a5f811db4 |
Close
Hashes for bzip3-0.0.8-pp38-pypy38_pp73-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04de2cbc4bc5672c6606d04f7f19998bb07a1fd2371220037be838ef113985c3 |
|
MD5 | 30b7900ff2e1a01ab504a83cbf90408d |
|
BLAKE2b-256 | 1343e85e339c2af88f61b9a90e9c93840b5fbd6584dce4100fcb5ee84ea0c480 |
Close
Hashes for bzip3-0.0.8-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 868fee32702d44ef0daa9debbfabb260a79bcf721a83362d45c211c6fab7ac21 |
|
MD5 | 29655e315e38f8903afa5fb311ae42eb |
|
BLAKE2b-256 | 6d159eb415ffb5818bb650b4e8b885ce689a09e7c82881a310c5dc5a5316cfce |
Close
Hashes for bzip3-0.0.8-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c91bd9e4f075bb479f78d75e6370cf0dae8a1adbe78cd6e8544762d88250792f |
|
MD5 | acf8845a8c1da9da61d4e6367699180e |
|
BLAKE2b-256 | 55de08341bcfb968d0c01d3fe6a98d5b6805f0bd7a23a1ca16fccba3db29fbb6 |
Close
Hashes for bzip3-0.0.8-pp37-pypy37_pp73-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 132aa1e01f7234d3e1e534c334aca917d268eb65ece78e54870661239f7e1ea5 |
|
MD5 | 5bd74e98379be01a29995c1ad2b59440 |
|
BLAKE2b-256 | 9f5e26976f487b4f8100d009922602826a90738f4d6142ffd8d4af2109dd4980 |
Close
Hashes for bzip3-0.0.8-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8fbe0a74e745c47ee85fd464127b69d2348ef6ffd8ef7890446350ddee4fe41 |
|
MD5 | ce17fdaf8796ab128aec333c55f2e4ad |
|
BLAKE2b-256 | b78c81e7da92d4fba9a496967940d75fc2b269ed310a643a06e9da31ea565eb6 |
Close
Hashes for bzip3-0.0.8-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea61894b1f61aa2f41b38d51d711e04cee4de6efa268b666aabd39f74d69e0d0 |
|
MD5 | 92f1fae19d80c217e4353facfae9c444 |
|
BLAKE2b-256 | 17bfe6afd58664b6c3253c81f4b9e58ada13467ce7c3fefd36125079b432cd26 |
Close
Hashes for bzip3-0.0.8-cp311-cp311-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2c937cac1e3e6c247e53d40ef215d10ab98bdf310d3d08640bca0aa3a85bbcb |
|
MD5 | f04b6c4b09f8c9ff8cbe104faef8fed4 |
|
BLAKE2b-256 | 756300f832e9fa1785d8795cbfeecd3d04f7c9ecf82edc9c717a4c93b1baf66b |
Close
Hashes for bzip3-0.0.8-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc23d19d450336b734c2e6cdfc7ab6f0a000572be19c119c8c44920580d900e5 |
|
MD5 | effec4f7da13afcdc13becaae52c5872 |
|
BLAKE2b-256 | 7aa1faa4804d5fcaccb57b9c8be717d20114015b8a334c63d896c22eafbf088f |
Close
Hashes for bzip3-0.0.8-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40540c4b45824fcd7a14dc304fb2aa83f3543eefa471ea05a94f9ff15acaf677 |
|
MD5 | 2dcf31a7bc0fbb8ab3b88d013f6b4118 |
|
BLAKE2b-256 | d4cf408fe9adc3f23424e24fb3ecc90c0874c8e7cfdb04adde5adcf57b8efefd |
Close
Hashes for bzip3-0.0.8-cp310-cp310-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4f22e5d72789e2756f99cf1d3d476d83f1847c77129ef16100793f684f1ed9a |
|
MD5 | 5884600e84526a8dca7ee98266a572ac |
|
BLAKE2b-256 | 5ddfdb996edab90511ccae8838f697cd75f7f86ce83997cfe8aafb232a347145 |
Close
Hashes for bzip3-0.0.8-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae6ae18589748cd74cd0e2d7b676f5fb69b7493bd7f8bdaea2169a0c167f5509 |
|
MD5 | d34709f973f0d60732aefb3bcb75a04c |
|
BLAKE2b-256 | c807a5435d447beaf4e49163b9c7650c8b9d1db93ae9901254f949c1e28dc7c4 |
Close
Hashes for bzip3-0.0.8-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 643e0c90c7ea4c16123021f8b502e8698ca5c2812c2025ce05807cc25bad6c2e |
|
MD5 | 9d20bb724a4de61b31215d19fdb55fea |
|
BLAKE2b-256 | ea9fffa3aa576b711038e5290c56e9e3c396492a2b7a9261b03969b3cc21cbf0 |
Close
Hashes for bzip3-0.0.8-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9efe650d6d2c883c15fbc092e2e46d0b5724aa2094db0a7a271152a0545317d |
|
MD5 | d159c0892adc405d0dcedce42835dfac |
|
BLAKE2b-256 | 1309147a55a1bdec48764e3c2f4f24e1d1b8143837044fcd209da58e68752f17 |
Close
Hashes for bzip3-0.0.8-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdc6e149734c80c53ebf22a25042bdf85c238a898e880ca6f2de7f456740a7c8 |
|
MD5 | 0508f9f792a74ca15f15171a8aeed50c |
|
BLAKE2b-256 | ddfc7827c46ff9fb06e3132219eb2a575b7701a8de713746abc2635507a8edfd |
Close
Hashes for bzip3-0.0.8-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fef42a2419c06eea01331c6ee651de8a6070571b6d6585783a7c11e660372f7 |
|
MD5 | 08dcf10d2fd491dd8866e1520b47b855 |
|
BLAKE2b-256 | a707990aacdf77035a98fa6db3afcc05e68245b7b30e1ebd367fdcecfeca3958 |
Close
Hashes for bzip3-0.0.8-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56bc321247d3071610de8459112a679a2bdcf3dd4caa279d38efa021d1b7aed5 |
|
MD5 | dcb618a190f0acc905913391feecc165 |
|
BLAKE2b-256 | 30c23075ac92a2717b1b330709f000ba6719cce89b4780cde3b14f7e91d9b5ce |
Close
Hashes for bzip3-0.0.8-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 130d51fc11eb2759ee0dbd24c71f208a5b560fb5cb5310f5871cd8c9d87f81d4 |
|
MD5 | 5b6b14c011e9e76a8d192495ff54fc9f |
|
BLAKE2b-256 | d49f2d4abdca5b4cc649512e2814491547cd7f25820d03f858c833fe13ef4f3e |
Close
Hashes for bzip3-0.0.8-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c4b457ff592bb6a5dcc6f9449a304b52fbe88cf6b32f28dfe502cdb2569aa3c |
|
MD5 | d128a6268d0a9a5da05388238a847043 |
|
BLAKE2b-256 | c2c96594c52f121b47ccef5a62f73bd930c06b7ea76bfaf09e79b327ab301efc |
Close
Hashes for bzip3-0.0.8-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a25023c90e393009a61b6823bf5123a8945e237cebebedcea99db8e2f5b8dd3 |
|
MD5 | 793c6c50bbc576999dc4e8c87396b504 |
|
BLAKE2b-256 | 7fd22d02bca898d03b8f490ac346a621866e6015c9a9afdba4c89987c7d4d5bd |
Close
Hashes for bzip3-0.0.8-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc14497f8ee8743cfb4cfd2d5b03b60045eb39a6d5b6f73bece0ada417feb328 |
|
MD5 | 344b8394761b392883b58a3bcab6d8c1 |
|
BLAKE2b-256 | 48b38a8967fdcef9e6990c97df2ed921abba5195fe3f2dabbbbe5f50e5382029 |