~ebel/read-progress-rs

A rust library wrapping a `Read` in something that records how many bytes have been read
440d01f0 — Amanda McCann 1 year, 4 months ago
v0.5.0
18078c19 — Amanda McCann 1 year, 4 months ago
docs: changelog
b638134b — Amanda McCann 1 year, 4 months ago
chore: relicence under MIT/Apache2/AGPL

clone

read-only
https://git.sr.ht/~ebel/read-progress-rs
read/write
git@git.sr.ht:~ebel/read-progress-rs

You can also use your local clone with git send-email.

#read-progress

This std::io::Read wrapper allows you to answer: “How much of this file has been read?”

Monitor how much you have read from a Read.

#Usage

use read_progress::ReaderWithSize;
let mut rdr = ReaderWithSize::from_file(file)?;
// ...
// ... [ perform regular reads ]
rdr.fraction()         // 0 (nothing) → 1 (everything) with how much of the file has been read

// Based on how fast the file is being read you can call:
rdr.eta()              // `std::time::Duration` with how long until it's finished
rdr.est_total_time()   // `std::time::Instant` when, at this rate, it'll be finished

Available under the MIT, or Apache-2.0 or GNU Affero GPL 3.0+.