Use BufReader in file_info example

This commit is contained in:
Sam Rijs 2018-11-06 23:14:09 +11:00
parent 27c79de0f8
commit 493424e93d

View file

@ -1,6 +1,7 @@
extern crate zip;
use std::fs;
use std::io::BufReader;
fn main() {
std::process::exit(real_main());
@ -14,8 +15,9 @@ fn real_main() -> i32 {
}
let fname = std::path::Path::new(&*args[1]);
let file = fs::File::open(&fname).unwrap();
let reader = BufReader::new(file);
let mut archive = zip::ZipArchive::new(file).unwrap();
let mut archive = zip::ZipArchive::new(reader).unwrap();
for i in 0..archive.len() {
let file = archive.by_index(i).unwrap();