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.1.0.tar.gz
(187.7 kB
view hashes)
Built Distributions
bzip3-0.1.0-cp311-cp311-win_amd64.whl
(286.0 kB
view hashes)
bzip3-0.1.0-cp310-cp310-win_amd64.whl
(287.0 kB
view hashes)
bzip3-0.1.0-cp39-cp39-win_amd64.whl
(287.9 kB
view hashes)
bzip3-0.1.0-cp38-cp38-win_amd64.whl
(288.3 kB
view hashes)
bzip3-0.1.0-cp37-cp37m-win_amd64.whl
(286.9 kB
view hashes)
Close
Hashes for bzip3-0.1.0-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac5bc909a0201efc31c28de84517240057b7df8c15fcb66b0fc1aba6ccde0e0c |
|
MD5 | d208b3a2af9c13f266888a34dd245235 |
|
BLAKE2b-256 | 760903aff0ac96ec79d8e79053ed51ff29ad07fd24e774d7762d4587cc91316f |
Close
Hashes for bzip3-0.1.0-pp38-pypy38_pp73-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb956828747ea39ebe22d0c9a4531495752e92dc3477873b04cf0143e9561448 |
|
MD5 | 440b399d45595a41e749dffa0361ae7c |
|
BLAKE2b-256 | 474a556e0a4e4621e85eaeb74b268222d219e2f422e0bff1b4b161955a5570d9 |
Close
Hashes for bzip3-0.1.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4793868717da275bf0c1e2e827f8c1c9fbb7edd5427aaf5cc9d1feb7dd040b3 |
|
MD5 | 56e4bd43a9b03d09d3373e7d3ef913e2 |
|
BLAKE2b-256 | 56bc9376af23a509d55a7e452f96f96574020d48b1b898113ecccf355c70443a |
Close
Hashes for bzip3-0.1.0-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36e4beb708d79feee70d33f02ffe0f932bf42f1c4b636f568ce79b4550e28326 |
|
MD5 | cb64f4a37d2d7bd561a9bd236b726032 |
|
BLAKE2b-256 | 9158f80bccd1fccdff1792c48519efc6a708478c4bea044705b4d8ece8913b27 |
Close
Hashes for bzip3-0.1.0-pp37-pypy37_pp73-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be0e981032b6d5bcb71690b755d1e7a431fbfa939e95a562d3754c660e1c62c5 |
|
MD5 | 418f1697078ea935512de8b8c0b0dbf2 |
|
BLAKE2b-256 | a57a027ba25c0d33ef3fde61d25ae33be8c58545476ee2284fd9ea3f79795493 |
Close
Hashes for bzip3-0.1.0-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45b5c13cdd2a38b26d83e7ddfad46f0e8d2f04b49b39bdd19ebc546a20acfbf3 |
|
MD5 | 28386bc0d34a2dadb5d7c369918a57c8 |
|
BLAKE2b-256 | 1680feee59bde4e517f3b09cf3aa90d20a1e3a72b7fbdc2163f6302a29926306 |
Close
Hashes for bzip3-0.1.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ac61dd127a600fcd66dbf0773ffea30a73f12106b258a5645da817cafd88c43 |
|
MD5 | c1180bc7f5652a170cee8bb36f8cab96 |
|
BLAKE2b-256 | 1ea69fee58d9721b873a96d9f8a9e3e34bbfbdb6d8f6f8088f7f628eff2605fd |
Close
Hashes for bzip3-0.1.0-cp311-cp311-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2717abebd4233509a524e07061b09f5035fbaa426c5d25d36243a195e5995cd |
|
MD5 | febf36a2f4d99fbd10cc83474cc3e273 |
|
BLAKE2b-256 | e14c156a67c65b2c7fe9ed9a052f53938f2a53b4cc2056a3c2a704cd49c7e389 |
Close
Hashes for bzip3-0.1.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8db8586c3b54d5588146b0f1b79625cf7e4e19f39c046dc1e443ee2974054d7b |
|
MD5 | 1250add19cc4ae94f59e11a333511126 |
|
BLAKE2b-256 | 737bd65fc39abe5722bd1984b4736e2ec2a146729b75bf2b419273f989a783ae |
Close
Hashes for bzip3-0.1.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81a450ac4964e3c2136aafa0ac4631ccc12a579635d2ba2941441ce5ff52684c |
|
MD5 | 9bb1e48688728fff91e22f505eff7f06 |
|
BLAKE2b-256 | 97df6e23ff383349d5b1ad75b6853c115ec88f7bf06b09a97a4bb9761b4a3f4d |
Close
Hashes for bzip3-0.1.0-cp310-cp310-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba1a4414397c1b9d553574492c25ce23f71f1ff51f37a1176e7b06f2f49366ad |
|
MD5 | 6cc8ec87f85b25cd18396197529f44ac |
|
BLAKE2b-256 | 46ec26d3064982fc606ebeb12e207d2e390ddc4fa1b9f1ae4922fa4f2763058b |
Close
Hashes for bzip3-0.1.0-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33d2d5c9558875183d9dbf030290869445940d7f2cb8ccf1e80961dd1526e1d5 |
|
MD5 | c7c89f2bfd0eb1e4645f780494ef884d |
|
BLAKE2b-256 | c6789692ddf0ee43303ba741528d75f4a10c06d30634a65df94755ec8c42462e |
Close
Hashes for bzip3-0.1.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ec505e442fca7ea9c2a56389d1b902ad14a7e7480323511e5d350b0fba4ff3e |
|
MD5 | 877d729371ce52fca6d2cf7a5ea49559 |
|
BLAKE2b-256 | 8e7f0924d0d351b6bf84dcd8d2171f956355d55333e0d7b42856772a653a37e9 |
Close
Hashes for bzip3-0.1.0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea95cba9563cd77dfa04c0ce2a6ee9dcd6ed4aec0b1fbcbc1ed388ea68c9d6ea |
|
MD5 | b1bf6051cb253c89604be0da21f87da4 |
|
BLAKE2b-256 | 2ec6d25a53cc656dea3312b158b9aa1f29ae73dab3fb7d379977a5d3a035f8cc |
Close
Hashes for bzip3-0.1.0-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2789dbe2e2f4427bea50bd97fd92c364fad45cb55f7812d4c86980f58d6eb070 |
|
MD5 | 76e5af67bfa670b4f2c2647c81f7b9aa |
|
BLAKE2b-256 | 518ba6dc290a041008193760b0f6d50402a791f485c5c7e4f92fa0a64172b587 |
Close
Hashes for bzip3-0.1.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 199eea85945ea9b28ec2430cf529f860c6331828296811ba76730e0e7033dce7 |
|
MD5 | a01c1357eb497a39f3280ddd9efdec64 |
|
BLAKE2b-256 | 520a69c033b405582ba7968573be95a3b6e4d71082d5d382961226b60d6635f0 |
Close
Hashes for bzip3-0.1.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 292e12315433dfe3ba6dc78d931179f3ef96c2fd6561ae2f0462b1be41410c36 |
|
MD5 | e5ca82490060cf01b30c451bfa87b3dd |
|
BLAKE2b-256 | 28c92a1124fe6ecbb6b66246e46cd153c3aea990c4ec97eb92a3a675dc7c2f36 |
Close
Hashes for bzip3-0.1.0-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4538df57783057763396ba5c50b9fc5c25b67a691044ea28b4c0965f7208dcb2 |
|
MD5 | c9340cecbecdd8d78fb3c75cc4891ad4 |
|
BLAKE2b-256 | 10a49ec0cca455c6d61971e5368ec9f3e5a83d710f3a4f12714aa7c13378f7d9 |
Close
Hashes for bzip3-0.1.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09c6fba40b076635399ea9bb9d635b1b0e3cac27baff3c8c5dd15052f61dea50 |
|
MD5 | 35bee48430929e6476304cdf1503827b |
|
BLAKE2b-256 | 4fb32808a0b6c1c1fc20af90c6a784c5dde683a5088b3d7ba96e51f7c6068a0b |
Close
Hashes for bzip3-0.1.0-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4cb200524766383543ecbdd99badbfa6e7ac0c7d5db798e1622368379bbbc12 |
|
MD5 | ccbe7a2c6a4cf045b8d8e00390134ed9 |
|
BLAKE2b-256 | 02fd46c879d5d60c76c56a6a2d001d3b6d4ea553d925d354cace10f85f64f304 |
Close
Hashes for bzip3-0.1.0-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e12610d2328487e6a18edf58692b4aae4e01c7558ec6ed92ecdf55030b3bafb8 |
|
MD5 | d5a26a4fcbd0b92c8d0dd77e5d840585 |
|
BLAKE2b-256 | dee1ceb0f70028fbd6cc236e28f12e2ddb5722d9d6d10c233c251bbd0348143b |