bzip2-rs
bzip2-rs copied to clipboard
Way to know how many compressed bytes were read when decompressing
This is more for user feedback than anything, but I was looking for a way to know how many bytes of the compressed source had been read, rather than the number of decompressed bytes, so that I can get accurate ETA's.
For example:
let input = File::open(input.expect("Could not get path"))?;
let size = input.metadata()?.len();
let reader = BufReader::new(input);
let mut md = MultiBzDecoder::new(reader);
let mut buffer = [0; BUFFER_LENGTH];
let mut n = md.read(&mut buffer)?;
n
appears to me to be how many uncompressed bytes were read, How do I know how far along in the file I've read and how it compares to size
?