bz3 compress and decompress
Project description
✨ python-bz3 ✨
The python binding for bzip3 with parallel support
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", num_threads=4) as f:
f.write("test data")
with bz3.open("test.bz3", "rt", encoding="utf-8", num_threads=4) as f:
print(f.read())
- use
BZ3_USE_CFFI
env var to specify a backend num_threads
is only available on cython backend which have openmp support
Public functions
from typing import IO, Optional, Union
def compress_file(input: IO, output: IO, block_size: int) -> None: ...
def decompress_file(input: IO, output: IO) -> None: ...
def recover_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 = ..., num_threads: int = ..., ignore_error: bool = False) -> 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 = ..., num_threads: int = 1, ignore_error: bool = False) -> BZ3File: ...
def compress(data: bytes, block_size: int = ..., num_threads: int = 1) -> bytes: ...
def decompress(data: bytes, num_threads: int = 1) -> bytes: ...
def libversion() -> str: ... # Get bzip3 version
def bound(inp: 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.3.tar.gz
(262.4 kB
view hashes)
Built Distributions
bzip3-0.1.3-cp312-cp312-win_amd64.whl
(394.5 kB
view hashes)
bzip3-0.1.3-cp311-cp311-win_amd64.whl
(393.0 kB
view hashes)
bzip3-0.1.3-cp310-cp310-win_amd64.whl
(392.6 kB
view hashes)
bzip3-0.1.3-cp39-cp39-win_amd64.whl
(393.4 kB
view hashes)
bzip3-0.1.3-cp38-cp38-win_amd64.whl
(393.5 kB
view hashes)
bzip3-0.1.3-cp37-cp37m-win_amd64.whl
(390.7 kB
view hashes)
Close
Hashes for bzip3-0.1.3-pp310-pypy310_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c69176de22ce11c0a330eece8903c7837f26ad2d3155c3b1fcc7defeba7dfe70 |
|
MD5 | 16a12c85d289ef122d3d5e2297083578 |
|
BLAKE2b-256 | 150e880b53cadf4218a0f305e44e9a69e53592edc7361c03772b8010448503a0 |
Close
Hashes for bzip3-0.1.3-pp310-pypy310_pp73-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66e09d9f8956718bae9c5aebd7ab11fa9cf9991b62eacb4d642c7ffe7c46c9d5 |
|
MD5 | 845b62e4d879e320be23feb62da8dcb5 |
|
BLAKE2b-256 | e0db7117d3f4fe4b8381b8ed7eff78a71e5cdbaaaee47eecb147f47394cce259 |
Close
Hashes for bzip3-0.1.3-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8679d46e33d2cc015221b7b73f0be065844970e6e7b3bfaa951ca6c5819b5191 |
|
MD5 | 376a49824339c46cc6c1bbf8bd5ae8a1 |
|
BLAKE2b-256 | 5126acfef3141312b4a741ccc64815175197f1876b3da031cc047c917e5d2c4e |
Close
Hashes for bzip3-0.1.3-pp39-pypy39_pp73-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46a78937eb75ed2dea35580d52ccd5b298643f8815569bc680ad4ad75237f819 |
|
MD5 | bfe1460341dc5cc259dca418bdf54bc2 |
|
BLAKE2b-256 | 4df7cf418ec6b650aea16cd00dda7c1f8c6f4f44a3bbc8824d783852d4251962 |
Close
Hashes for bzip3-0.1.3-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 683e9df870e7181a2821db329ebb4ed033fb32ee3cd9ad0e0f283b3d5eb29554 |
|
MD5 | 2e9a8db06a0b08946d8689fe68e6fa58 |
|
BLAKE2b-256 | 6eacf9b81d0f71c70cfe937a9963e435035419102b998d4c3bf7f087ae4eab54 |
Close
Hashes for bzip3-0.1.3-pp38-pypy38_pp73-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ab718be362ed3c59fce8330bb0ec7c7825f10a008dbbd8b88ab07bf453f728e |
|
MD5 | d0bd60b9b8d7738808728650e513be07 |
|
BLAKE2b-256 | 0fe336d7e5f86965a14b658ae2bab45f0e3ee3346d8e2ad1c169a75eb3052ceb |
Close
Hashes for bzip3-0.1.3-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b104e5951429da6716b02c629ae2150a5f5c0dc82017dcfac61c168dd698cc9 |
|
MD5 | 4dcf0f5ae66e9bb2b69602d07f2c5bf8 |
|
BLAKE2b-256 | 39db0df055c0c405519cb4cd5eac0b93a8000f21386369a16b19cb4bea8586cd |
Close
Hashes for bzip3-0.1.3-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da39288302b226ab9b7f38a77f79cc7990107ef380bd6d8dda64f1d17e0c1a60 |
|
MD5 | 4189c16797fc78bb5e5881e60c9151cb |
|
BLAKE2b-256 | 15fd92c19c12776f575fe924251ba262442f5f319ff82dbe95be0c721bc39027 |
Close
Hashes for bzip3-0.1.3-cp312-cp312-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06e275c16e6cc96c5e1a7b373effd2a7c88321903d648ff6fbad8e907f8df9bb |
|
MD5 | 0414ed15f7c11c4bd1d137b2191a8fab |
|
BLAKE2b-256 | a90b6835ec77634b67835300d539a2029528858194142944dd0722594254fb9d |
Close
Hashes for bzip3-0.1.3-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dda0d42eb36546dce91bde869deaecdba80c3c0bc232bd372e79b090ee5c43e3 |
|
MD5 | 36c6994277eb7f46707ca9caefa4aebe |
|
BLAKE2b-256 | 00475faf012ba5e1195cb5fa32c6c61d4abba193411166a1f30fe17b069f162f |
Close
Hashes for bzip3-0.1.3-cp311-cp311-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b90aa69a75e37888a091ff931db3c9b64930ba390c24a7ffe1437e2e35d31dbf |
|
MD5 | 67ec3e2e764ca6f2d50cce7424b2ebee |
|
BLAKE2b-256 | 4285df0b24cdd6c2a7a7615d9461599c0efcff3b924bd8420ff8ea5f75293d88 |
Close
Hashes for bzip3-0.1.3-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 916842cd94090578b4ce5e72a2862ea0d6ff863f41dd85aecb7c48d6743633e6 |
|
MD5 | 7f25637ff351bc77cb8e66b95b3509b0 |
|
BLAKE2b-256 | 2676a6bc784625da4c035ce45ea1ea76163931991928bba7fce9a55658d0d342 |
Close
Hashes for bzip3-0.1.3-cp310-cp310-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d193f5ae85d80f44dcab0d9bbf1be5658edb6486d35fba70afea27dc5563ebc0 |
|
MD5 | 157b5d1a80f4e9618ec906a9dbbc34cb |
|
BLAKE2b-256 | 2e2b34ba3814e9eaff33e151fb6c6feed1f29fc3cfc168ffd65cca5891187daf |
Close
Hashes for bzip3-0.1.3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12b759e69bd598b37f381bdefb26b59e6a33eb030ae14fda02eb2315a5d823bb |
|
MD5 | 6fcb9158d2e70f2f13e16b15680df589 |
|
BLAKE2b-256 | 5ff74418ffefac193edc08f2c8ae20c9be15537e515e3e51e58269ce745015ce |
Close
Hashes for bzip3-0.1.3-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d291d64009afa0bff72b6eb02ec43bf2f962c73269fe8e17103ca809e1aaa0e |
|
MD5 | 934862539f87e6ad7d103c2915ed1642 |
|
BLAKE2b-256 | 333d40c41e3dc00deb8533949907dfd1f5049de69015a35657a448cf4b762ddd |
Close
Hashes for bzip3-0.1.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b78e282d906281b7be97eb55bb9cafd289c522ce24ab34aa3f4177fb7a18778 |
|
MD5 | a897c4660908aa3c28d33f9248506f92 |
|
BLAKE2b-256 | cc30702a2f22dcbafc5f8132e354364810ae9e98aa1e4ef285b51ca1c1499a8f |
Close
Hashes for bzip3-0.1.3-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 718339c4e2c4230c88e7f7289ebca3b1e533f8c6845365589b37a0c1f99c0f6c |
|
MD5 | ac568b7fde6be5e44b1330640aee21b7 |
|
BLAKE2b-256 | fb1ec0568412dca4c94453edef92336d01fdfbf27a011c078fe2dac7fc0a37ad |
Close
Hashes for bzip3-0.1.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bb9b0b357bef92c950273184376de8a10c9b81fb4f6e52358291c95c50c9fd8 |
|
MD5 | 57e2bb0d309bb5278b0b39c0a4816815 |
|
BLAKE2b-256 | 3c023eb9d58ffb409f131e015a1251635e2c29736d732025a19d9cadeefe089d |
Close
Hashes for bzip3-0.1.3-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ddd9a6c81ea9c633e4ad3de482b7ef8f215ea3a18a0605f66046cf89feab91f |
|
MD5 | e4ec5b3404db41f8552b1dedfe34eb16 |
|
BLAKE2b-256 | 4bf2753aa7502a05f0e1248ba5e57084eba4835d0deb8f2ab984885234203c46 |