#tar-archive #encoding #tar

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.

11 unstable releases

Uses new Rust 2024

0.6.0 Jan 23, 2026
0.5.1 Oct 22, 2025
0.5.0 Sep 2, 2024
0.4.2 Aug 24, 2021
0.1.1 Dec 24, 2019

#28 in Compression

Download history 32414/week @ 2025-12-27 209521/week @ 2026-01-03 309383/week @ 2026-01-10 367072/week @ 2026-01-17 328965/week @ 2026-01-24 272149/week @ 2026-01-31 235374/week @ 2026-02-07 215124/week @ 2026-02-14 249268/week @ 2026-02-21 313066/week @ 2026-02-28 243126/week @ 2026-03-07 153701/week @ 2026-03-14 41209/week @ 2026-03-21 40949/week @ 2026-03-28 38316/week @ 2026-04-04 38301/week @ 2026-04-11

166,698 downloads per month
Used in 43 crates (18 directly)

MIT/Apache

165KB
3.5K SLoC

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.

Dependencies

~0.1–5.5MB
~118K SLoC