-
extern crate flate2;
-
use std::io;
-
use std::io::{prelude::*};
-
use std::fs::File;
-
use flate2::read::GzDecoder;
-
-
fn main() {
-
println!("Hello, world!");
-
let file = File::open("/tmp/access.log-20220609.gz").unwrap();
-
let d = GzDecoder::new(file);
-
-
let mut r = io::BufReader::new(d);
-
-
let mut buf = String::new();
-
-
r.read_to_string(&mut buf).unwrap();
-
println!("{}",buf);
-
-
-
}
可以按行读取wangsp.blog.cs dn.net/article/details/110003883
阅读(1258) | 评论(0) | 转发(0) |