file-chunker

Crates.iofile-chunker
lib.rsfile-chunker
version0.1.1
sourcesrc
created_at2022-02-09 12:50:28.841306
updated_at2022-02-10 12:49:31.868224
descriptionEfficiently process a file in (approximately) equally-sized parts
homepagehttps://github.com/acj/file-chunker
repositoryhttps://github.com/acj/file-chunker
max_upload_size
id529685
size18,169
Adam Jensen (acj)

documentation

https://docs.rs/file-chunker/

README

file-chunker

This crate provides the FileChunker type, which is useful for efficiently reading a file in (approximately) equally-sized parts.

The original use case was to process a log file in chunks, one thread per chunk, and to guarantee that each chunk ended with a full line of text.

Example

use file_chunker::FileChunker;
let file = std::fs::File::open("/path/to/file").unwrap();
let chunker = FileChunker::new(&file).unwrap();
chunker.chunks(1024, Some('\n'))
    .unwrap()
    .iter()
    .for_each(|chunk| {
        println!("{:?}", chunk);
    });
Commit count: 11

cargo fmt