#lz4 #interface #frame #format #encode #decode

sys minilz4

Minimal interface for the LZ4 compression library frame format

7 releases (breaking)

0.6.1 May 19, 2023
0.6.0 Feb 2, 2023
0.5.0 Feb 17, 2021
0.4.0 Apr 22, 2020
0.1.0 Apr 15, 2020

#453 in Compression

Download history 25/week @ 2024-07-28 8/week @ 2024-09-22 1/week @ 2024-09-29 2/week @ 2024-10-06

54 downloads per month
Used in staticfilemap

BSD-2-Clause

345KB
6.5K SLoC

C 5.5K SLoC // 0.2% comments Rust 485 SLoC Visual Studio Project 182 SLoC Visual Studio Solution 25 SLoC

minilz4

Crates.io Docs.rs

Minimal interface for the LZ4 compression library frame format.

Links to LZ4 1.9.4.

Usage

Examples

Simple

use minilz4::{Encode, EncoderBuilder, Decode};
use std::io::Cursor;

let data = "Blushing is the color of virtue.";

let encoded = Cursor::new(data).encode(&EncoderBuilder::new()).unwrap();
let decoded = Cursor::new(encoded).decode().unwrap();

Read & Write Traits

use minilz4::{EncoderBuilder, Decoder};
use std::io::{Cursor, copy};

let data = "Blushing is the color of virtue.";

let mut encoder = EncoderBuilder::new().build(Vec::new()).unwrap();
copy(&mut Cursor::new(data.as_bytes()), &mut encoder).unwrap();
let encoded = encoder.finish().unwrap();

let mut decoder = Decoder::new(Cursor::new(encoded)).unwrap();
let mut decoded = Vec::new();
decoder.read_to_end(&mut decoded).unwrap();

Dependencies

~0.4–325KB