13 releases (7 breaking)

0.12.0 Dec 30, 2025
0.11.0 Dec 18, 2024
0.9.0 Dec 8, 2023
0.8.3 Oct 20, 2023
0.5.0 Mar 25, 2023

#395 in Compression

Download history 1282/week @ 2026-04-09 1933/week @ 2026-04-16 3376/week @ 2026-04-23 3632/week @ 2026-04-30 1268/week @ 2026-05-07 3082/week @ 2026-05-14 2098/week @ 2026-05-21 2312/week @ 2026-05-28 2096/week @ 2026-06-04 4156/week @ 2026-06-11 2479/week @ 2026-06-18 2488/week @ 2026-06-25 1265/week @ 2026-07-02 1873/week @ 2026-07-09 1090/week @ 2026-07-16 964/week @ 2026-07-23

6,152 downloads per month
Used in 5 crates

LGPL-3.0-only

140KB
2.5K SLoC

C 1.5K SLoC // 0.1% comments Rust 835 SLoC // 0.0% comments M4 311 SLoC // 0.5% comments Automake 56 SLoC // 0.0% comments Shell 17 SLoC // 0.1% comments

BZip3-rs

BZip3 compression for Rust.

BZip3 file structure:

[ magic number ([u8; 5]) | block size (i32) | block1 | block2 | blockN... ]

Structure of each block: [ new size (i32) | read size (i32) | data ]

Due to the naming from the original bzip3 library, new size indicates the data size after compression, and read size indicates the original data size.

Examples

use std::io::Read;
use bzip3::read::{Bz3Decoder, Bz3Encoder};

let data = "hello, world".as_bytes();
let block_size = 100 * 1024; // 100 kiB

let mut compressor = Bz3Encoder::new(data, block_size).unwrap();
let mut decompressor = Bz3Decoder::new(&mut compressor).unwrap();

let mut contents = String::new();
decompressor.read_to_string(&mut contents).unwrap();
assert_eq!(contents, "hello, world");

bzip3-rs

This is a Rust wrapper for bzip3.

Documentation

Crate Features

Dependencies

~1.8–4MB
~85K SLoC