#tar-archive #tar #reader-writer #file-reader

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.

9 unstable releases

0.5.0 Sep 2, 2024
0.4.2 Aug 24, 2021
0.4.1 Jul 29, 2021
0.3.0 Jul 29, 2020
0.1.1 Dec 24, 2019

#30 in Compression

Download history 3327/week @ 2024-07-20 3695/week @ 2024-07-27 3072/week @ 2024-08-03 3550/week @ 2024-08-10 4812/week @ 2024-08-17 5823/week @ 2024-08-24 5283/week @ 2024-08-31 4690/week @ 2024-09-07 5372/week @ 2024-09-14 5544/week @ 2024-09-21 5469/week @ 2024-09-28 6326/week @ 2024-10-05 5997/week @ 2024-10-12 5773/week @ 2024-10-19 6187/week @ 2024-10-26 7152/week @ 2024-11-02

26,002 downloads per month
Used in 16 crates (10 directly)

MIT/Apache

150KB
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();
    });
}

MSRV

Minimal stable rust version: 1.63

An increase to the MSRV is accompanied by a minor version bump

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

~5–14MB
~184K SLoC