| Crates.io | tario |
| lib.rs | tario |
| version | 0.1.2 |
| created_at | 2025-09-16 12:56:20.184586+00 |
| updated_at | 2025-09-23 15:18:38.612838+00 |
| description | Asynchronously read and write TAR archives |
| homepage | |
| repository | https://github.com/dfunckt/tario |
| max_upload_size | |
| id | 1841618 |
| size | 109,433 |
A library to asynchronously read and write TAR archives in Rust.
Tario supports the ustar TAR format. It focuses on efficiently abstracting TAR I/O rather than being a general purpose utility to make all kinds of TAR archives. If that's not what you need, there's tar-rs that you should check out.
Tario is:
Using Cargo:
$ cargo add tario
Or manually by editing your project's Cargo.toml:
[dependencies]
tario = 0.1
Tario currently has the following feature switches:
streams: support for Streams. Enabled by default.Tario builds on Tokio's async read and write traits but is otherwise not using anything at all from it.
use tokio::io::{AsyncWrite, AsyncWriteExt};
use tario::{Archive, Header};
let mut io: Vec<u8> = Vec::new();
let mut archive = Archive::new(&mut io);
let mut files = [
// Assume a single entry for this example.
("hello.txt", "hello world!"),
];
for (path, contents) in files {
let mut header = Header::new_ustar();
header.set_path(path)?;
header.set_size(contents.len() as u64);
header.set_cksum();
let mut entry = archive.add_entry(header).await?;
entry.write(contents.as_bytes()).await?;
}
archive.finish().await?;
use std::io;
use tokio::io::{AsyncRead, AsyncReadExt};
use tario::Archive;
let io = io::Cursor::new(&[]); // Get a reader from somewhere
let mut archive = Archive::new(io);
let buf = &mut [0u8; 100];
while let Some(mut entry) = archive.next_entry().await? {
loop {
let bytes_written = entry.read(buf).await?;
if bytes_written == 0 {
// Reached entry EOF
break;
}
// do_something_with_buffer(&buf[..bytes_written]);
}
}
This project is licensed under the MIT license.