tiny-lz4-decoder-sys

Crates.iotiny-lz4-decoder-sys
lib.rstiny-lz4-decoder-sys
version1.0.1
sourcesrc
created_at2023-03-18 16:39:14.60415
updated_at2023-03-18 16:59:28.941829
descriptionzero dependency, tiny lz4 decompression wrapper built for lodpm
homepagehttps://github.com/foss-lodpm/tiny-lz4-decoder
repositoryhttps://github.com/foss-lodpm/tiny-lz4-decoder
max_upload_size
id813838
size8,651
Onur Özkan (onur-ozkan)

documentation

README

Tiny lz4 decoding wrapper package built specifically for lod package manager and Unix systems. If you need complete box of lz4, consider using lz4.

Adding lib to the project

In your Cargo.toml:

[dependencies]
tiny-lz4-decoder-sys = "1.0"

In build.rs of your binary crate:

use std::{env, path::Path};

fn main() {
    let home_path = env::var("HOME").expect("HOME environment variable is not set.");
    let lz4_so = Path::new(&home_path).join(".local/share/tiny_lz4_decoder_sys");

    println!("cargo:rustc-link-arg=-Wl,-rpath={}", lz4_so.display());
}

Usage

Simple usage:

use std::fs::File;

use tiny_lz4_decoder_sys::Decoder;

fn main() {
    let input_file = File::open("compressed_lz4").unwrap();
    let mut decoder = Decoder::new(input_file).unwrap();
    let mut output_file = File::create("decompressed_output").unwrap();
    std::io::copy(&mut decoder, &mut output_file).unwrap();
}

License

This package is covered under the MIT license. See the LICENSE file for more info.

Commit count: 8

cargo fmt