http-compress 3.0.18

A high-performance async library for HTTP compression/decompression, supporting Brotli, Deflate, and Gzip algorithms. Provides both compression and decompression capabilities with optimized memory usage, ideal for HTTP clients/servers and network programming.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::*;

#[test]
fn test() {
    let headers: HashMap<_, _, BuildHasherDefault<XxHash3_64>> =
        HashMap::with_hasher(BuildHasherDefault::default());
    let data: Vec<u8> = vec![];
    let body: Cow<'_, [u8]> = Compress::from(&headers).decode(&data, 1_024_000);
    assert_eq!(*body, data);
    let _ = Compress::Gzip.encode(&[], 1_024_000);
    let _ = Compress::Deflate.encode(&[], 1_024_000);
    let _ = Compress::Br.encode(&[], 1_024_000);
    let _ = Compress::Gzip.decode(&[], 1_024_000);
    let _ = Compress::Deflate.decode(&[], 1_024_000);
    let _ = Compress::Br.decode(&[], 1_024_000);
}