#http-request #http-response #redirect #tcp #compression #http #request-response

http-compress

A lightweight library for decompressing HTTP responses supporting Brotli, Deflate, and Gzip

57 stable releases

Uses new Rust 2024

new 2.12.1 Apr 18, 2025
2.12.0 Apr 13, 2025
2.10.1 Mar 29, 2025
2.2.4 Feb 19, 2025
0.0.2 Dec 22, 2024

#2140 in Network programming

Download history 93/week @ 2024-12-27 1028/week @ 2025-01-03 403/week @ 2025-01-10 1606/week @ 2025-01-17 33/week @ 2025-01-24 151/week @ 2025-01-31 458/week @ 2025-02-07 435/week @ 2025-02-14 233/week @ 2025-02-21 420/week @ 2025-02-28 756/week @ 2025-03-07 786/week @ 2025-03-14 1885/week @ 2025-03-21 460/week @ 2025-03-28 514/week @ 2025-04-04 323/week @ 2025-04-11

3,294 downloads per month
Used in 5 crates (via http-type)

MIT license

22KB
191 lines

http-compress

Official Documentation

Api Docs

A lightweight library for decompressing HTTP responses supporting Brotli, Deflate, and Gzip.

Features

Installation

To use this crate, you can run cmd:

cargo add http-compress

Use

Compress

use http_compress::*;
use core::hash::BuildHasherDefault;
use std::{borrow::Cow, collections::HashMap};

let headers: HashMap<_, _, BuildHasherDefault<XxHash3_64>> = HashMap::with_hasher(BuildHasherDefault::default());
let data: Vec<u8> = vec![];
let body: Cow<'_, Vec<u8>> = Compress::from(&headers).decode(&data, 1_024_000);
assert_eq!(*body, data);

Encode

use http_compress::*;
let _ = Compress::Gzip.encode(&[], 1_024_000);
let _ = Compress::Deflate.encode(&[], 1_024_000);
let _ = Compress::Br.encode(&[], 1_024_000);

Decode

use http_compress::*;
let _ = Compress::Gzip.decode(&[], 1_024_000);
let _ = Compress::Deflate.decode(&[], 1_024_000);
let _ = Compress::Br.decode(&[], 1_024_000);

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Contact

For any inquiries, please reach out to the author at ltpp-universe root@ltpp.vip.

Dependencies

~7MB
~272K SLoC