Skip to main content

bz3 压缩解压

项目描述

✨ python-bz3 ✨

bzip3的python绑定

皮皮 Python 执行 车轮 执照 行动

安装

pip install bzip3

用法

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())
  • 使用BZ3_USE_CFFIenv var 指定后端

公共职能

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: ...

下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

bzip3-0.0.6.tar.gz (179.1 kB 查看哈希

已上传 source

内置发行版

bzip3-0.0.6-pp38-pypy38_pp73-win_amd64.whl (265.5 kB 查看哈希

已上传 pp38

bzip3-0.0.6-pp38-pypy38_pp73-manylinux2014_x86_64.whl (302.9 kB 查看哈希

已上传 pp38

bzip3-0.0.6-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (271.1 kB 查看哈希

已上传 pp38

bzip3-0.0.6-pp37-pypy37_pp73-win_amd64.whl (265.6 kB 查看哈希

已上传 pp37

bzip3-0.0.6-pp37-pypy37_pp73-manylinux2014_x86_64.whl (303.1 kB 查看哈希

已上传 pp37

bzip3-0.0.6-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (271.1 kB 查看哈希

已上传 pp37

bzip3-0.0.6-cp310-cp310-win_amd64.whl (274.5 kB 查看哈希

已上传 cp310

bzip3-0.0.6-cp310-cp310-manylinux2014_x86_64.whl (324.3 kB 查看哈希

已上传 cp310

bzip3-0.0.6-cp310-cp310-macosx_10_15_x86_64.whl (292.7 kB 查看哈希

已上传 cp310

bzip3-0.0.6-cp39-cp39-win_amd64.whl (275.2 kB 查看哈希

已上传 cp39

bzip3-0.0.6-cp39-cp39-manylinux2014_x86_64.whl (325.6 kB 查看哈希

已上传 cp39

bzip3-0.0.6-cp39-cp39-macosx_10_15_x86_64.whl (291.4 kB 查看哈希

已上传 cp39

bzip3-0.0.6-cp38-cp38-win_amd64.whl (275.7 kB 查看哈希

已上传 cp38

bzip3-0.0.6-cp38-cp38-manylinux2014_x86_64.whl (324.9 kB 查看哈希

已上传 cp38

bzip3-0.0.6-cp38-cp38-macosx_10_15_x86_64.whl (288.7 kB 查看哈希

已上传 cp38

bzip3-0.0.6-cp37-cp37m-win_amd64.whl (274.3 kB 查看哈希

已上传 cp37

bzip3-0.0.6-cp37-cp37m-manylinux2014_x86_64.whl (324.3 kB 查看哈希

已上传 cp37

bzip3-0.0.6-cp37-cp37m-macosx_10_15_x86_64.whl (288.6 kB 查看哈希

已上传 cp37

bzip3-0.0.6-cp36-cp36m-win_amd64.whl (274.5 kB 查看哈希

已上传 cp36

bzip3-0.0.6-cp36-cp36m-manylinux2014_x86_64.whl (325.0 kB 查看哈希

已上传 cp36

bzip3-0.0.6-cp36-cp36m-macosx_10_14_x86_64.whl (292.1 kB 查看哈希

已上传 cp36