10 releases (stable)

1.5.0 Nov 23, 2023
1.4.1 Dec 27, 2022
1.4.0 Jan 30, 2021
1.3.0 Oct 6, 2020
0.3.1 May 5, 2015

#46 in HTTP client

Download history 207729/week @ 2025-12-19 110851/week @ 2025-12-26 375583/week @ 2026-01-02 578881/week @ 2026-01-09 642055/week @ 2026-01-16 656386/week @ 2026-01-23 673566/week @ 2026-01-30 657138/week @ 2026-02-06 642404/week @ 2026-02-13 769554/week @ 2026-02-20 986056/week @ 2026-02-27 911185/week @ 2026-03-06 887625/week @ 2026-03-13 889304/week @ 2026-03-20 859808/week @ 2026-03-27 1054974/week @ 2026-04-03

3,853,446 downloads per month
Used in 808 crates (14 directly)

MIT/Apache

18KB
357 lines

rust-chunked-transfer

Documentation

Encoder and decoder for HTTP chunked transfer coding. For more information about chunked transfer encoding:

Example

Decoding

use chunked_transfer::Decoder;
use std::io::Read;

let encoded = b"3\r\nhel\r\nb\r\nlo world!!!\r\n0\r\n\r\n";
let mut decoded = String::new();

let mut decoder = Decoder::new(encoded as &[u8]);
decoder.read_to_string(&mut decoded);

assert_eq!(decoded, "hello world!!!");

Encoding

use chunked_transfer::Encoder;
use std::io::Write;

let mut decoded = "hello world";
let mut encoded: Vec<u8> = vec![];

{
    let mut encoder = Encoder::with_chunks_size(&mut encoded, 5);
    encoder.write_all(decoded.as_bytes());
}

assert_eq!(encoded, b"5\r\nhello\r\n5\r\n worl\r\n1\r\nd\r\n0\r\n\r\n");

Authors

License

Licensed under either of:

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps