| Crates.io | tarfs |
| lib.rs | tarfs |
| version | 0.2.5 |
| created_at | 2025-03-14 00:39:59.800102+00 |
| updated_at | 2025-08-27 05:38:54.045604+00 |
| description | Tar reading library, designed for using in embedded systems |
| homepage | |
| repository | https://github.com/NDRAEY/tarfs_oxide |
| max_upload_size | |
| id | 1591682 |
| size | 16,148 |
This is a no_std implementation of Tar archive format reader.
This crate's architecture allows to be usable in embedded systems like operating system kernels.
This crate uses "devices" as an universal interface to read data.
You can implement Device trait (that also needs no_std_io::io::Read and no_std_io::io::Seek to be implemented) for your structure and use it with tarfs.
See src/file_device.rs for approximate implementation.
Add this crate by running this command:
cargo add tarfs
Here's a simple example to list all entries in archive:
let fs = TarFS::from_device(FileDevice(File::open("archive.tar").unwrap()));
if fs.is_none() {
println!("Failed to open TAR file.");
return;
}
let mut fs = fs.unwrap();
let entries = fs.list().unwrap();
for i in entries {
println!("Entry `{}`; Size: `{}`", &i.name, i.size);
}
Read text file to string:
let lore: String = fs.read_to_string("/Ninjago Lore.txt")?;
Read binary file:
let mut data = vec![0; 32];
fs.read_file("/ScientificData.bin", /* position */ 0, &mut data)?;
Read API reference on docs.rs.