Open marc47marc47 opened 2 years ago
use flate2::read::GzDecoder; use std::fs::File; use std::path::PathBuf; use tar::Archive;
type Result
fn main() -> Result<()> { let file = File::open("archive.tar.gz")?; let mut archive = Archive::new(GzDecoder::new(file)); let prefix = "bundle/logs";
println!("Extracted the following files:");
archive
.entries()?
.filter_map(|e| e.ok())
.map(|mut entry| -> Result<PathBuf> {
let path = entry.path()?.strip_prefix(prefix).unwrap().to_owned();
entry.unpack(&path)?;
Ok(path)
})
.filter_map(|e| e.ok())
.for_each(|x| println!("> {}", x.display()));
Ok(())
}
T
,E
--> /Users/marc47/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs:503:10For more information about this error, try
rustc --explain E0107
. error: could not compiletar03
due to previous error