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.9.tar.gz
(187.6 kB
view hashes)
Built Distributions
bzip3-0.0.9-cp311-cp311-win_amd64.whl
(286.0 kB
view hashes)
bzip3-0.0.9-cp310-cp310-win_amd64.whl
(287.0 kB
view hashes)
bzip3-0.0.9-cp39-cp39-win_amd64.whl
(287.9 kB
view hashes)
bzip3-0.0.9-cp38-cp38-win_amd64.whl
(288.3 kB
view hashes)
bzip3-0.0.9-cp37-cp37m-win_amd64.whl
(286.8 kB
view hashes)
Close
Hashes for bzip3-0.0.9-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 836f4e31ac4071e733e6e5cb8fbc2deb61c4947ca63f56363b7e0b0572ca7ed2 |
|
MD5 | 2e2aee0617e6b7f23eff48a490644812 |
|
BLAKE2b-256 | f3462ea88468204b50f087fcffc7ed8630e057ef818c7d607faa3e1234488cf8 |
Close
Hashes for bzip3-0.0.9-pp38-pypy38_pp73-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19f7f053cc6748d181571e28c87cc7f7bad40b2fae5fccf1290d6bef14f4f5cd |
|
MD5 | 3b2ff328bd8da6d73c731089e27da9d2 |
|
BLAKE2b-256 | d5572250d0d285e26c8e41413b3f09a8874a3e46742b26bdc0db23d541904260 |
Close
Hashes for bzip3-0.0.9-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd4fc0bf3a6f88314d8a4835ed83c2aef9d79ba6cb62905ac39ecc665dd6e3b6 |
|
MD5 | 68fdff2d083f694316a6180e8303b0e1 |
|
BLAKE2b-256 | 088653ca19853e97d53c75adf9f752848a49c9d4c7f85b069d2bd5c984e503a7 |
Close
Hashes for bzip3-0.0.9-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | caaacf7911373e75356e0fd834c8b2b0bae440ceabdbee30ba9b86f799d50bc1 |
|
MD5 | a37f137d740e27c288494072d43917cc |
|
BLAKE2b-256 | b81cd913e66e2e49a7b36821b1205a995fb8109f786bbfd989e611ef0dfa2add |
Close
Hashes for bzip3-0.0.9-pp37-pypy37_pp73-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc23587d42f2bbbd2f955a51e779ffd7c4aa120f175f8db58038db3161c08d0f |
|
MD5 | 41c744fc59f3dfb01ff2e52cc41d203f |
|
BLAKE2b-256 | e32277373ba1d777dddbe022c6e839ce77db97b06ede080b2d0036ce5f852b44 |
Close
Hashes for bzip3-0.0.9-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51c2541f59adec84ab20979dcf20363d5824147f9b279ef5212f9cc9f14ef682 |
|
MD5 | 8f632396d053fd3880efa4c15198d227 |
|
BLAKE2b-256 | 31163d6bcd9090c14663934df0f92a954631f9646944d7b3d7f02676f0e06f9d |
Close
Hashes for bzip3-0.0.9-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7e2c3475a7b42e7a7501d88914dbdd833420d16ff7349aacc4422d80a284097 |
|
MD5 | 8970421eb99fc0ff5aba74f68bbd6422 |
|
BLAKE2b-256 | 5d03af4a2ba0abb7de8b3afe467ba8d4b4247704537d2bdada1a65625e9c2b57 |
Close
Hashes for bzip3-0.0.9-cp311-cp311-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3328da42d407165bbf00b4a99987db7e67039708f91ad4830e0cf78cca85dbf4 |
|
MD5 | b55c0e6705a2d4421aabdf406e2f4dcf |
|
BLAKE2b-256 | d18f6497bf9fcbdbaceed0697044ae9c2a9e5b06fbd265add5f6bd2d2a56e462 |
Close
Hashes for bzip3-0.0.9-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2349f6b06333cef53ae99acd3cdb5b2ca2591f34c2f99f00f7418e0a416f9038 |
|
MD5 | 78656a82c0f0867a704bd792f6ed27fd |
|
BLAKE2b-256 | e1437957f3ff656b26a6fed67c284f8280c2b22d563e0ec36981bed6395c5dcf |
Close
Hashes for bzip3-0.0.9-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc6116dd97dcacb054f8797b9bc27a6ba2db2c40e27a1d75058d7724fe9c937f |
|
MD5 | 4cece615c6223c71573547132ceca76c |
|
BLAKE2b-256 | efcd7820896c1f86eb20914720e886315a838becd19bcf08c213e72a87fbeff2 |
Close
Hashes for bzip3-0.0.9-cp310-cp310-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd360bbfae6bc96fa8914fd14321a09aaa9aee2741b8117cb7c7344c0237c44e |
|
MD5 | 67ba4a3438cd4c752a6548c45dfa986f |
|
BLAKE2b-256 | 625f7e6fb951e3bf58ea97ee0b87f342038dec2987cc4e1c679e7a1867aa030e |
Close
Hashes for bzip3-0.0.9-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16e32e5899c9062770419bacfb51b6ce9ce817c58394ea891e2f588bc84b3c8f |
|
MD5 | d9e71e2a86afd49cea0efe3062385096 |
|
BLAKE2b-256 | c01e595300843e8c17e72bd323baebb0c953a151c4557a76c41874496be256e2 |
Close
Hashes for bzip3-0.0.9-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1644d78c5d1ac36bad290389a0c3c64e5ba3c94ec59495e94fcd659aa40c31dd |
|
MD5 | 5fcd755f552b97f2caa2bb79ff4867ac |
|
BLAKE2b-256 | 221cd355c009f22112749b9e62ab7b976f54bead73e5946ca409571942f1bc47 |
Close
Hashes for bzip3-0.0.9-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bff88989aee0fa45acde0ae7418aaba7c988334d1de33afbe7c5fcb5d15eb665 |
|
MD5 | 8120cf6f4dc11373dd14ef0cb808f7d7 |
|
BLAKE2b-256 | 8cb800ad7ef3e533ddf2d1c585b4c07473ca2710379a355d6249556368c0869b |
Close
Hashes for bzip3-0.0.9-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53375259e401bf132918d1744afce27696361efe8440fcfc99049173c32f388d |
|
MD5 | 5cdd83bcb1a1b7b900bebb1bf6b19f1d |
|
BLAKE2b-256 | 0614b950134fe9275bf4612387db82ac572b3cbd86bffb97edc461bafe6513c9 |
Close
Hashes for bzip3-0.0.9-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | beeeeda026d954ccad8e45e10c0a711a7887ebdd289926d89ff7b473afcab07f |
|
MD5 | db4e5e8216008b84f4795f29d3d823c9 |
|
BLAKE2b-256 | 94fbc9c0ca6dac40a9e40976c8b9b277df289fdc3306755e50af77135b41dd2c |
Close
Hashes for bzip3-0.0.9-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99c8cb87da7ff43c2e72f01874143b5fcad60cdddc22cb48c4b8dcffc2e83327 |
|
MD5 | 1b1c5cb12d530020d876bc9fa0e1fd5c |
|
BLAKE2b-256 | 82ee8e0ff37234c8f1b382d52492420e823e894d7376057822eddf37514a6429 |
Close
Hashes for bzip3-0.0.9-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de019c7174d2f2ca0d85168efba8c34151ff3559ed03822bbaeb2bb69c71ceee |
|
MD5 | 6314e59c70811f69efa6a564f63d8a12 |
|
BLAKE2b-256 | 0680baac1877dbada50a35a6bc3053e37d35813a18057ec3b2dd6a96876bdc4a |
Close
Hashes for bzip3-0.0.9-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6e07105007bb93006491e73300517565314410ffcf8d3d4f6fee8e49b5e1960 |
|
MD5 | 1e9d34c8512bda82dba53ba597fb975c |
|
BLAKE2b-256 | 93fa67d63115449fb5a3502e0533ebeafc06eb28ecc2de06e55c86291c38b1ea |
Close
Hashes for bzip3-0.0.9-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfc5d959c8d72438aee73f1a2abd44cd2fc9e7dba547ddcca2ab940bb965f7da |
|
MD5 | 819f087ad666cf11fba9a3542e7c35f8 |
|
BLAKE2b-256 | d8b8625c245ec4921798fb0c1c7d9d6c915f3a311e1f6316c0878b8b053acc89 |
Close
Hashes for bzip3-0.0.9-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59f2abb08a63b1cbd3a62a00c2d6228145fc63f38a0870103521975ad659beb6 |
|
MD5 | 19c40f61f0545608ee1d7363107f0ae4 |
|
BLAKE2b-256 | bde3e1b9d4943c20e7a9e59b505971a8e1c702e89493287f206e2436cc2d4690 |