Crates.io | minilz4 |
lib.rs | minilz4 |
version | 0.6.1 |
source | src |
created_at | 2020-04-15 09:48:54.385282 |
updated_at | 2023-05-19 10:36:33.697409 |
description | Minimal interface for the LZ4 compression library frame format |
homepage | |
repository | https://github.com/Systemcluster/minilz4 |
max_upload_size | |
id | 230432 |
size | 492,491 |
Minimal interface for the LZ4 compression library frame format.
Links to LZ4 1.9.4.
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();
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();