zstd-sys

A rust binding for the zstd compression library.

Latest version: 2.0.13+zstd.1.5.6 registry icon
Maintenance score
100
Safety score
100
Popularity score
84
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
2.0.13+zstd.1.5.6 0 0 0 0 0
2.0.12+zstd.1.5.6 0 0 0 0 0
2.0.11+zstd.1.5.6 0 0 0 0 0
2.0.10+zstd.1.5.6 0 0 0 0 0
2.0.9+zstd.1.5.5 0 0 0 0 0
2.0.8+zstd.1.5.5 0 0 0 0 0
2.0.7+zstd.1.5.4 0 0 0 0 0
2.0.6+zstd.1.5.2 0 0 0 0 0
2.0.5+zstd.1.5.2 0 0 0 0 0
2.0.4+zstd.1.5.2 0 0 0 0 0
2.0.3+zstd.1.5.2 0 0 0 0 0
2.0.2+zstd.1.5.2 0 0 0 0 0
2.0.1+zstd.1.5.2 0 0 0 0 0
2.0.0+zstd.1.5.2 0 0 0 0 0
1.6.4+zstd.1.5.2 0 0 0 0 0
1.6.3+zstd.1.5.2 0 0 0 0 0
1.6.2+zstd.1.5.1 0 0 0 0 0
1.6.1+zstd.1.5.0 0 0 0 0 0
1.6.0+zstd.1.5.0 0 0 0 0 0
1.5.0+zstd.1.4.9 0 0 0 0 0
1.4.20+zstd.1.4.9 0 0 0 0 0
1.4.19+zstd.1.4.8 0 0 0 0 0
1.4.18+zstd.1.4.7 0 0 0 0 0
1.4.17+zstd.1.4.5 0 0 0 0 0
1.4.16+zstd.1.4.5 0 0 0 0 0
1.4.15+zstd.1.4.4 0 0 0 0 0
1.4.14+zstd.1.4.3 0 0 0 0 0
1.4.13+zstd.1.4.3 0 0 0 0 0
1.4.12+zstd.1.4.2 0 0 0 0 0
1.4.11+zstd.1.4.1 0 0 0 0 0
1.4.10+zstd.1.4.0 0 0 0 0 0
1.4.8+zstd.1.3.8 0 0 0 0 0
1.4.7+zstd.1.3.8 0 0 0 0 0
1.4.6+zstd.1.3.7 0 0 0 0 0
1.4.5+zstd.1.3.6 0 0 0 0 0
1.4.4+zstd.1.3.5 0 0 0 0 0
1.4.3+zstd.1.3.4 0 0 0 0 0
1.4.2+zstd.1.3.3 0 0 0 0 0
1.4.1+zstd.1.3.2 0 0 0 0 0
1.4.0+zstd.1.3.2 0 0 0 0 0
1.3.2 0 0 0 0 0
1.3.1 0 0 0 0 0
1.3.0 0 0 0 0 0
1.2.0 0 0 0 0 0
1.1.5-a 0 0 0 0 0
1.1.4 0 0 0 0 0

Stability
Latest release:

2.0.13+zstd.1.5.6 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

Apache-2.0   -   Apache License 2.0

Not a wildcard

Not proprietary

OSI Compliant


MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant



zstd

crates.io MIT licensed

Build on Linux Build on Windows Build on macOS Build on wasm

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

1 - Add to cargo.toml

$ cargo add zstd
# Cargo.toml

[dependencies]
zstd = "0.13"

2 - Usage

This library provides Read and Write wrappers to handle (de)compression, along with convenience functions to made common tasks easier.

For instance, stream::copy_encode and stream::copy_decode are easy-to-use wrappers around std::io::copy. Check the stream example:

use std::io;

// This function use the convenient `copy_encode` method
fn compress(level: i32) {
    zstd::stream::copy_encode(io::stdin(), io::stdout(), level).unwrap();
}

// This function does the same thing, directly using an `Encoder`:
fn compress_manually(level: i32) {
    let mut encoder = zstd::stream::Encoder::new(io::stdout(), level).unwrap();
    io::copy(&mut io::stdin(), &mut encoder).unwrap();
    encoder.finish().unwrap();
}

fn decompress() {
    zstd::stream::copy_decode(io::stdin(), io::stdout()).unwrap();
}

Asynchronous support

The async-compression crate provides an async-ready integration of various compression algorithms, including zstd-rs.

Compile it yourself

zstd is included 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.

Build-time bindgen

This library includes a pre-generated bindings.rs file. You can also generate new bindings at build-time, using the bindgen feature:

cargo build --features bindgen

TODO

  • Benchmarks, optimizations, ...

Disclaimer

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

License

  • The zstd C library is under a dual BSD/GPLv2 license.
  • This zstd-rs binding library is under a MIT license.