#tar-archive #tar #file-reader #async-io #reader-writer #encoding

async-tar-wasm

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. This fork includes the ability to disable filesystem operations, so the crate can be used in wasm32-unknown-unknown environments.

1 unstable release

0.4.2-wasm.1 Feb 25, 2023

#417 in Compression

Download history 47/week @ 2024-07-27 33/week @ 2024-08-03 27/week @ 2024-08-10 23/week @ 2024-08-17 24/week @ 2024-08-24 56/week @ 2024-08-31 47/week @ 2024-09-07 26/week @ 2024-09-14 26/week @ 2024-09-21 15/week @ 2024-09-28 24/week @ 2024-10-05 39/week @ 2024-10-12 21/week @ 2024-10-19 10/week @ 2024-10-26 25/week @ 2024-11-02 9/week @ 2024-11-09

68 downloads per month
Used in 3 crates (via nassun)

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–13MB
~183K SLoC