limit-reader

Crates.iolimit-reader
lib.rslimit-reader
version0.1.4
sourcesrc
created_at2024-06-05 12:20:13.337248
updated_at2024-06-28 11:20:22.244051
descriptionA simple reader that limits the number of bytes read from an underlying reader.
homepage
repositoryhttps://github.com/fzdwx/limit-reader
max_upload_size
id1262705
size52,653
like (fzdwx)

documentation

README

Limit Reader

A simple reader that limits the number of bytes read from an underlying reader.

Install

cargo add limit-reader

Usage

fn foo() {
    let hello_txt = fs::File::open("file").unwrap();
    let mut reader = LimiterReader::new(hello_txt, 1024 * 1024);
    let mut r1 = vec![0u8];
    reader.read_to_end(&mut r1).unwrap();
}
Commit count: 7

cargo fmt