#tar-archive #tar #reader-writer #file-reader #encoding #content


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.

1 unstable release

0.4.0 Mar 30, 2024

#139 in Compression

Download history 739/week @ 2024-03-27 986/week @ 2024-04-03 1086/week @ 2024-04-10 599/week @ 2024-04-17 488/week @ 2024-04-24 270/week @ 2024-05-01 491/week @ 2024-05-08 497/week @ 2024-05-15 321/week @ 2024-05-22 453/week @ 2024-05-29

1,810 downloads per month
Used in 3 crates (2 directly)




A tar archive reading/writing library for async Rust.

Based on the great tar-rs.

Reading an archive

use tokio::io::stdin;
use tokio::prelude::*;

use tokio_tar::Archive;

fn main() {
    tokio::runtime::Runtime::new().unwrap().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 tokio::fs::File;
use tokio_tar::Builder;

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

        a.append_file("lib.rs", &mut File::open("src/lib.rs").await.unwrap())


This project is licensed under either of

at your option.


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.


~160K SLoC