5 releases

0.2.0 Jun 9, 2023
0.1.3 Jun 12, 2020
0.1.2 Jul 30, 2018
0.1.1 May 9, 2018
0.1.0 May 7, 2018

#222 in Compression

Download history 368/week @ 2023-12-14 289/week @ 2023-12-21 367/week @ 2023-12-28 729/week @ 2024-01-04 383/week @ 2024-01-11 516/week @ 2024-01-18 617/week @ 2024-01-25 453/week @ 2024-02-01 633/week @ 2024-02-08 625/week @ 2024-02-15 498/week @ 2024-02-22 403/week @ 2024-02-29 170/week @ 2024-03-07 861/week @ 2024-03-14 597/week @ 2024-03-21 766/week @ 2024-03-28

2,456 downloads per month
Used in seripack

MIT license

40KB
403 lines

Blosc

Rust bindings for the C-Blosc compression library.

Build Status

The blosc crate provides Rusty bindings for C-Blosc, a compression library for binary data, especially numeric arrays.

Usage

# Cargo.toml
[dependencies]
blosc = "0.1"
extern crate blosc;

fn main() {
    let data: Vec<u32> = vec![1, 1, 2, 5, 8, 13, 21, 34, 55, 89, 144];
    let ctx = blosc::Context::new();
    let compressed = ctx.compress(&data[..]);
    let decompressed = decompress(&compressed).unwrap();
    assert_eq!(data, decompressed);
}

License

blosc is distributed under the MIT license. See LICENSE-MIT for details.


lib.rs:

Rust bindings for the C-Blosc block-oriented compression library.

Blosc is a high performance compressor optimized for binary data. It is especially good at compressing arrays of similar data. For example, floats that fit a particular statistical distribution, integers from a restricted range, or pointers that all share the same alignment. It also works well on arrays of Structs with similar content.

Unlike most other compression libraries, Blosc is block-oriented, rather than stream-oriented. This works well when the entire dataset to be compressed/decompressed is available at once.

Example

let data: Vec<u32> = vec![1, 1, 2, 5, 8, 13, 21, 34, 55, 89, 144];
let ctx = Context::new();
let compressed = ctx.compress(&data[..]);
let decompressed = decompress(&compressed).unwrap();
assert_eq!(data, decompressed);

Dependencies

~42KB