This library is a rust binding for the zstd compression library.
Using cargo-edit
$ cargo add zstd
# Cargo.toml
[dependencies]
zstd = "0.1"
Check the stream example:
extern crate zstd;
use std::io;
fn compress(level: i32) {
let mut encoder = zstd::Encoder::new(io::stdout(), level).unwrap();
io::copy(&mut io::stdin(), &mut encoder).unwrap();
encoder.finish().unwrap();
}
fn decompress() {
let mut decoder = zstd::Decoder::new(io::stdin()).unwrap();
io::copy(&mut decoder, &mut io::stdout()).unwrap();
}
This repository includes zstd
as a submodule. To get everything during your clone, use :
git clone https://github.com/Gyscos/zstd-rs --recursive
Or, if you cloned it without the --recursive
flag, call this from inside the repository:
git submodule update --init
Then, running cargo build
should take care of building the C library and linking to it.
- Benchmarks, optimizations, ...
This implementation is largely inspired by bozaro's lz4-rs.