diff options
Diffstat (limited to 'vendor/tar/examples/list.rs')
-rw-r--r-- | vendor/tar/examples/list.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/vendor/tar/examples/list.rs b/vendor/tar/examples/list.rs new file mode 100644 index 0000000..e2d58da --- /dev/null +++ b/vendor/tar/examples/list.rs @@ -0,0 +1,17 @@ +//! An example of listing the file names of entries in an archive. +//! +//! Takes a tarball on stdin and prints out all of the entries inside. + +extern crate tar; + +use std::io::stdin; + +use tar::Archive; + +fn main() { + let mut ar = Archive::new(stdin()); + for file in ar.entries().unwrap() { + let f = file.unwrap(); + println!("{}", f.path().unwrap().display()); + } +} |