| Crates.io | rustar |
| lib.rs | rustar |
| version | 0.1.4 |
| created_at | 2025-09-14 13:32:00.531+00 |
| updated_at | 2025-09-14 18:56:51.937955+00 |
| description | A pure-rust USTAR implementation for OS-dev |
| homepage | |
| repository | https://github.com/x-nbnv/rustar |
| max_upload_size | |
| id | 1838741 |
| size | 23,209 |
RUSTAR (Rust + USTAR) is a minimal, safe (hopefully), and #![no_std]-friendly library for parsing USTAR archives.
It is designed primarily for Rust-Based OS development, in the case one might bundle their kernel modules, init programs, or resources in a .tar and extract them at runtime (for an initramfs kinda thing)
Using RUSTAR as your filesystem format handler has some big advantages:
#![no_std], requires only alloc if you need owned Vec<u8>.cargo test.#![no_std] compatibleTarIter) to walk over headerstar_lookup)extract_file)tar --format=ustar archivesThis is an example implementation for it in an OS kernel, so same rules apply to a basic no_std environment:
for header in rustar::TarIter::new(archive) {
println!("file: {} ({} bytes)", header.name, header.size);
}
if let Some(init_bin) = rustar::extract_file(archive, "init.bin") {
// load and run init program…
}
You can include a tar file directly in your unit tests (this is the included unit test):
#[test]
fn test_extract_file() {
let archive: &[u8] = include_bytes!("../tests/sample.tar");
let file = rustar::extract_file(archive, "hello.txt")
.expect("file not found");
assert_eq!(file, b"Hello World!\n");
}
Create an (already provided) test tar with:
echo "Hello World!" > hello.txt
tar --format=ustar -cf tests/sample.tar hello.txt
Run tests:
cargo test
no_std) , although i may already switch over my OS to fat12 or something by thenTarHeader::contents(&self, archive: &[u8]) helperthis project uses the MIT License, in full effect. give me credit via name/username :3 (if you want)
Brought to you by your favourite puppygirl Liz 🐾
![]()