I'm trying to read a gzip-compressed file line by line.
I used the method suggested in this post. It works fine for the first ~700 lines of the file, but then stops without error and ignores the next millions of lines.
Here is a minimal working example (Rust 1.57.0):
use std::io::{prelude::*, BufReader};
use std::fs::File;
use flate2; // 1.0
use flate2::read::GzDecoder;
fn main() {
let r1 = "/home/path/to/bigfile.gz";
let file = File::open(r1).unwrap();
let reader = BufReader::new(GzDecoder::new(file));
let mut i = 0;
for l in reader.lines() {
println!("{}", i);
i+=1;
}
}
Since this code compiles and is able to read the start of the file, why does it stop at some point?