#tar-archive #tar #reader-writer #file-reader #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.

8 releases

0.4.2 Aug 24, 2021
0.4.1 Jul 29, 2021
0.3.0 Jul 29, 2020
0.2.0 Jul 26, 2020
0.1.1 Dec 24, 2019

#90 in Compression

Download history 1383/week @ 2023-12-14 745/week @ 2023-12-21 931/week @ 2023-12-28 810/week @ 2024-01-04 1070/week @ 2024-01-11 1547/week @ 2024-01-18 3161/week @ 2024-01-25 1865/week @ 2024-02-01 1611/week @ 2024-02-08 2380/week @ 2024-02-15 3516/week @ 2024-02-22 3394/week @ 2024-02-29 2309/week @ 2024-03-07 2523/week @ 2024-03-14 2086/week @ 2024-03-21 1720/week @ 2024-03-28

9,203 downloads per month
Used in 14 crates (9 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.51

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–17MB
~204K SLoC