File: list.rs

package info (click to toggle)
rust-async-tar 0.4.2-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 440 kB
  • sloc: makefile: 2
file content (20 lines) | stat: -rw-r--r-- 539 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//! 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 async_tar;

use async_std::{io::stdin, prelude::*};

use async_tar::Archive;

fn main() {
    async_std::task::block_on(async {
        let 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());
        }
    });
}