Skip to main content

Crate isomage

Crate isomage 

Source
Expand description

§isomage

Browse and extract files from ISO 9660 and UDF disc images directly, without mounting them. Pure-Rust, zero runtime dependencies, no CLI binary.

§What this library does

  • Parses ISO 9660 (with Joliet and Rock Ridge extensions) and UDF disc images into a TreeNode hierarchy rooted at "/".
  • Lets you stream a single file’s bytes (cat_node) or extract a file or subtree to disk (extract_node) without loading the whole image into memory.
  • Never writes to the input image: read-only by design.

Detection is automatic — call detect_and_parse_filesystem and the library will try ISO 9660 first, then UDF, returning whichever matches.

§Safety

extract_node enforces that every output path stays inside the caller-supplied output directory. Entries with names containing path separators, NUL bytes, ., .., or empty strings are rejected with a clear error rather than silently written. This protects against adversarial ISOs whose directory entries (e.g. Rock Ridge NM records) attempt to write outside the destination via .. traversal.

cat_node returns Ok(()) when the downstream writer closes its pipe (BrokenPipe), matching standard Unix pipeline behaviour (e.g. cat_node(&node, &mut stdout())? piped to head).

§Quick example

use std::fs::File;
use isomage::detect_and_parse_filesystem;

let mut file = File::open("disc.iso")?;
let root = detect_and_parse_filesystem(&mut file, "disc.iso")?;

for child in &root.children {
    let kind = if child.is_directory { "d" } else { "-" };
    println!("{} {} ({} bytes)", kind, child.name, child.size);
}

Re-exports§

pub use tree::TreeNode;

Modules§

formats
Per-format submodules added in v3.0.
image_io
Image-reader abstractions.
iso9660
ISO 9660 / ECMA-119 parser, with the Joliet (Unicode filenames) and Rock Ridge (POSIX long filenames) extensions.
tree
The TreeNode model: a single in-memory representation of a parsed disc’s directory tree, shared by both parsers.
udf
UDF (ECMA-167) parser. Supports metadata partitions and multi-extent files — enough for typical CD/DVD/Blu-ray media.

Functions§

cat_node
Stream a file from the ISO to writer in fixed-size chunks.
detect_and_parse_filesystem
Parse the filesystem contained in file, returning the root node of the directory tree.
detect_and_parse_filesystem_verbose
Like detect_and_parse_filesystem, but prints spec-section-tagged diagnostics to stderr while parsing.
extract_node
Extract node (a file or a directory subtree) to output_path on disk.

Type Aliases§

Error
The error type returned by every fallible public function in this crate.
Result
The result type returned by every fallible public function in this crate.