Skip to content
forked from gyscos/zstd-rs

A rust binding for the zstd compression library.

License

Notifications You must be signed in to change notification settings

spaolacci/zstd-rs

 
 

Repository files navigation

zstd

Build Status crates.io MIT licensed

This library is a rust binding for the zstd compression library.

1 - Add to cargo.toml

$ cargo add zstd

Manually

# Cargo.toml

[dependencies]
zstd = "0.1"

2 - Usage

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();
}

Compile it yourself

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.

TODO

  • Benchmarks, optimizations, ...

Disclaimer

This implementation is largely inspired by bozaro's lz4-rs.

License

MIT

About

A rust binding for the zstd compression library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 99.4%
  • Shell 0.6%