dignifiedquire/async-tar

A tar archive reading/writing library for async Rust.

Rust

83

516 commits

updated Aug 20, 2026

See the code

README

async-tar

A tar archive reading/writing library for async Rust.


Based on the great tar-rs.

Features

  • runtime-async-std: enabled by default, makes this crate compatible with async-std
  • runtime-tokio: makes this crate compatible with tokio

Note: These features are mutually exclusive. Enable only one runtime feature.

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();
        a.into_inner().await.unwrap();
    });
}

MSRV

Minimal stable rust version: 1.85

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.

Contributors

(top 30 of 47)

alexcrichton

322 commits

dignifiedquire

68 commits

danieleades

13 commits

aidanhs

11 commits

dignifiedquire/async-tar

A tar archive reading/writing library for async Rust.

Rust

83

516 commits

updated Aug 20, 2026

See the code

README

async-tar

A tar archive reading/writing library for async Rust.


Based on the great tar-rs.

Features

  • runtime-async-std: enabled by default, makes this crate compatible with async-std
  • runtime-tokio: makes this crate compatible with tokio

Note: These features are mutually exclusive. Enable only one runtime feature.

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();
        a.into_inner().await.unwrap();
    });
}

MSRV

Minimal stable rust version: 1.85

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.

Contributors

(top 30 of 47)

alexcrichton

322 commits

dignifiedquire

68 commits

danieleades

13 commits

aidanhs

11 commits

Languages

Rust

100.0%