structured-zstd 0.0.26

Pure Rust zstd implementation — managed fork of ruzstd. Dictionary decompression, no FFI.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Compress an arbitrary file with our encoder at `Level(4)` (greedy).
//! Used by the profile pipeline to produce a `rust_stream` fixture
//! that the `profile_decode` example can iterate over.
//!
//! Usage: `cargo run --release --example encode_l4 <input> <output>`

fn main() {
    let args: Vec<String> = std::env::args().collect();
    let input = args.get(1).expect("usage: encode_l4 <input> <output.zst>");
    let output = args.get(2).expect("usage: encode_l4 <input> <output.zst>");
    let data = std::fs::read(input).expect("read input");
    let out = structured_zstd::encoding::compress_to_vec(
        data.as_slice(),
        structured_zstd::encoding::CompressionLevel::Level(4),
    );
    eprintln!("orig {} -> {}", data.len(), out.len());
    std::fs::write(output, &out).expect("write output");
}