$ lz4_flex

v0.12.1

Fastest LZ4 implementation in Rust, no unsafe by default.

Downloads: 79.6M
Recent: 18.8M
Versions: 39
Updated: March 14, 2026

Latest Update Summary

Crate

Name: lz4_flex New version: 0.12.0 Release date: 2025-11-11T10:55:12.125073Z

Crate readme

Short description Fastest LZ4 implementation in Rust.

Long description lz4_flex is a high-performance LZ4 compression library for Rust, featuring both block and frame formats. It supports no_std for the block format and offers feature flags for controlling safe and unsafe code usage. Benchmarks show it's one of the fastest implementations available. The library is compatible with various platforms and includes benchmarks against other LZ4 implementations.

Features • High performance • LZ4 Block format • LZ4 Frame format • Feature flags to configure safe/unsafe code usage • no-std support with block format • 32-bit support

Code Examples Usage Example for Compression and Decompression

 use lz4_flex::block::{compress_prepend_size, decompress_size_prepended};

fn main(){
    let input: &[u8] = b"Hello people, what's up?";
    let compressed = compress_prepend_size(input);
    let uncompressed = decompress_size_prepended(&compressed).unwrap();
    assert_eq!(input, uncompressed);
}

Safe Dependency Declaration

 lz4_flex = { version = "0.12" }

Performance Dependency Declaration

 lz4_flex = { version = "0.12", default-features = false }

Linkshttps://docs.rs/lz4_flexhttps://crates.io/crates/lz4_flexhttps://crates.io/crates/lz4-compresshttps://github.com/main--/rust-lz-fearhttps://crates.io/crates/lzzzzhttps://github.com/burntsushi/rust-snappyhttps://github.com/rust-lang/mirihttps://github.com/antoniomuso/lz4-napihttps://github.com/PSeitz/lz4-wasmhttps://github.com/LVivona/safelz4

https://api.github.com/repos/PSeitz/lz4_flex/releases/109034359

Release info

Release version:

Release description

Code Examples

Patch update: 0.12.0 → 0.12.1

$ DOWNLOADS TREND

52.2M79.6M

$ VERSION HISTORY

v0.12.1March 14, 2026
v0.12.0November 11, 2025
v0.11.5June 19, 2025

$ LINKS

$ INSTALL

cargo add lz4_flex

Or add to Cargo.toml: lz4_flex = "0.12.1"