[−][src]Function fungus::enc::tar::extract_all
pub fn extract_all<T: AsRef<Path>, U: AsRef<Path>>(
tarfile: T,
dst: U
) -> FuResult<()>
Extract all tarball files into the given dst
directory.
Examples
use fungus::prelude::*; let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("tar_extract_all_doc"); assert!(sys::remove_all(&tmpdir).is_ok()); assert!(sys::mkdir(&tmpdir).is_ok()); let file1 = tmpdir.mash("file1"); let tarball = tmpdir.mash("tarball.tgz"); let dst = tmpdir.mash("dst"); let dstfile = dst.mash("file1"); assert!(sys::write(&file1, "single file\n").is_ok()); assert!(tar::create(&tarball, &file1).is_ok()); assert!(tar::extract_all(&tarball, &dst).is_ok()); assert_eq!(sys::readstring(&dstfile).unwrap(), "single file\n".to_string()); assert!(sys::remove_all(&tmpdir).is_ok());