#tar #tarfile #encoding

async-tar

A Rust implementation of an async TAR file reader and writer. This library does not currently handle compression, but it is abstract over all I/O readers and writers. Additionally, great lengths are taken to ensure that the entire contents are never required to be entirely resident in memory all at once.

5 unstable releases

0.3.0 Jul 29, 2020
0.2.0 Jul 26, 2020
0.1.2 Jul 21, 2020
0.1.1 Dec 24, 2019
0.1.0 Dec 24, 2019

#356 in Encoding

Download history 124/week @ 2020-12-25 256/week @ 2021-01-01 336/week @ 2021-01-08 437/week @ 2021-01-15 428/week @ 2021-01-22 355/week @ 2021-01-29 353/week @ 2021-02-05 581/week @ 2021-02-12 282/week @ 2021-02-19 307/week @ 2021-02-26 315/week @ 2021-03-05 280/week @ 2021-03-12 314/week @ 2021-03-19 412/week @ 2021-03-26 442/week @ 2021-04-02 613/week @ 2021-04-09

1,448 downloads per month
Used in 3 crates

MIT/Apache

145KB
3K SLoC

async-tar

A tar archive reading/writing library for async Rust.


Based on the great tar-rs.

Reading an archive

use async_std::io::stdin;
use async_std::prelude::*;

use async_tar::Archive;

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

Writing an archive

use async_std::fs::File;
use async_tar::Builder;

fn main() {
    async_std::task::block_on(async {
        let file = File::create("foo.tar").await.unwrap();
        let mut a = Builder::new(file);

        a.append_path("README.md").await.unwrap();
        a.append_file("lib.rs", &mut File::open("src/lib.rs").await.unwrap())
            .await
            .unwrap();
    });
}

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~1.4–3.5MB
~66K SLoC