6 releases

new 0.2.1 May 24, 2024
0.2.0 Jun 9, 2023
0.1.3 Jun 12, 2020
0.1.2 Jul 30, 2018
0.1.1 May 9, 2018

#97 in Compression

Download history 399/week @ 2024-02-02 685/week @ 2024-02-09 503/week @ 2024-02-16 637/week @ 2024-02-23 262/week @ 2024-03-01 358/week @ 2024-03-08 928/week @ 2024-03-15 572/week @ 2024-03-22 682/week @ 2024-03-29 300/week @ 2024-04-05 308/week @ 2024-04-12 166/week @ 2024-04-19 329/week @ 2024-04-26 395/week @ 2024-05-03 534/week @ 2024-05-10 607/week @ 2024-05-17

1,896 downloads per month
Used in seripack

MIT license

41KB
405 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

~0.3–0.8MB
~20K SLoC