https://github.com/traceflight/lz4_decompress
Fastest pure Rust implementation of LZ4 decompression.
https://github.com/traceflight/lz4_decompress
Last synced: 5 months ago
JSON representation
Fastest pure Rust implementation of LZ4 decompression.
- Host: GitHub
- URL: https://github.com/traceflight/lz4_decompress
- Owner: traceflight
- License: mit
- Created: 2025-12-18T13:42:29.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-12-20T12:28:58.000Z (6 months ago)
- Last Synced: 2025-12-22T16:11:35.688Z (6 months ago)
- Language: Rust
- Homepage:
- Size: 12.2 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Notice: NOTICE
Awesome Lists containing this project
README
[](https://docs.rs/lz4_decompress)
[](https://crates.io/crates/lz4_decompress)
# lz4_decompress
Pure Rust implementation of lz4 decompression.
Fork of the awesome [lz4_flex](https://github.com/PSeitz/lz4_flex), modified to support decompressing data without providing the minimal uncompressed size.
## Features
- LZ4 Block format
- LZ4 Frame format
- Decompress without providing the minimal uncompressed size
### Block Format
The block format is only valid for smaller data chunks as block is decompressed in memory.
For larger data use the frame format, which consists of multiple blocks.
```rust
use lz4_decompress::block::{decompress_safe, decompress};
use lz4_flex::block::compress_prepend_size;
fn main(){
let input: &[u8] = b"Hello people, what's up?";
// we use lz4_flex to compress
let compressed = compress_prepend_size(input);
let uncompressed = decompress_size_prepended(&compressed).unwrap();
assert_eq!(input, uncompressed);
// remove size prefix
let compressed_without_size = &compressed[4..];
// decompress without providing min uncompressed size
let uncompressed = decompress_safe(&compressed_without_size, None).unwrap();
assert_eq!(input, uncompressed);
let uncompressed = decompress(&compressed_without_size, 24).unwrap();
assert_eq!(input, uncompressed);
}
```