| Crates.io | iso9660_core |
| lib.rs | iso9660_core |
| version | 0.1.0 |
| created_at | 2025-12-21 22:27:17.140792+00 |
| updated_at | 2025-12-21 22:27:17.140792+00 |
| description | Read-only ISO9660 crate for no_std environments (WIP) |
| homepage | |
| repository | https://github.com/Mathis-Z/iso9660_core |
| max_upload_size | |
| id | 1998682 |
| size | 58,354 |
use iso9660_core::{ISO9660, iso9660entry::IsISO9660Record};
use std::fs::File;
fn main() -> iso9660_core::ISOResult<()> {
// Open an existing ISO file
let iso_path = "example.iso";
let file = File::open(iso_path)?;
let mut fs = ISO9660::load(file)?;
// List the root directory
let mut iter = fs.listdir("/")?;
println!("Root directory:");
while let Some(entry) = iter.next(&mut fs) {
let entry = entry?;
println!(" {}", entry.identifier());
}
// Read a file into a buffer
let mut buffer = vec![0u8; 1024]; // adjust size as needed
let bytes_read = fs.read("README.TXT", &mut buffer, 0)?;
println!("Read {} bytes from README.TXT", bytes_read);
// Get total size of a file
let total_size = fs.total_size("README.TXT")?;
println!("Total size of README.TXT: {} bytes", total_size);
// Optional: print the directory tree
#[cfg(feature = "std")]
fs.print_tree();
Ok(())
}
The tests require genisoimage to be installed. Run with:
cargo test --features std
To run all tests:
cargo test --features std -- --include-ignored
(includes a test which runs longer and also needs ~5GB of free disk space to build the ISO)