xmr-btc-swap/examples/list.rs
Thomas Eizinger fec26926a8 Squashed 'tokio-tar/' content from commit 43dd166
git-subtree-dir: tokio-tar
git-subtree-split: 43dd166d0f3aff67891cd1c1bf4d6bfb984bb789
2021-02-25 11:20:47 +11:00

22 lines
582 B
Rust

//! 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 tokio_tar as async_tar;
use tokio::io::stdin;
use tokio_stream::*;
use async_tar::Archive;
fn main() {
tokio::runtime::Runtime::new().unwrap().block_on(async {
let mut ar = Archive::new(stdin());
let mut entries = ar.entries().unwrap();
while let Some(file) = entries.next().await {
let f = file.unwrap();
println!("{}", f.path().unwrap().display());
}
});
}