12 releases
| 0.2.6 | Jan 2, 2026 |
|---|---|
| 0.2.5 | Aug 27, 2025 |
| 0.2.3 | May 18, 2025 |
| 0.2.1 | Apr 4, 2025 |
| 0.1.4 | Mar 14, 2025 |
#698 in Filesystem
16KB
329 lines
TarFS
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.
Devices?
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.
Usage
Add this crate by running this command:
cargo add tarfs
Example
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.
Dependencies
~230–370KB