Crate cdfs

source ·
Expand description

cdfs

cdfs is a portable, userland implementation of the ISO 9660 / ECMA-119 filesystem typically found on CDs and DVDs.

Usage

To open an ISO image:

use cdfs::{DirectoryEntry, ISO9660};

let file = File::open("images/test.iso")?;
let iso = ISO9660::new(file)?;

To read a file:

let mut contents = Vec::new();
if let Some(DirectoryEntry::File(file)) = iso.open("README.md")? {
  file.read().read_to_end(&mut contents)?;
}

To iterate over items in a directory:

if let Some(DirectoryEntry::Directory(dir)) = iso.open("/tmp")? {
  for entry in dir.contents() {
    println!("{}", entry?.identifier());
  }
}

To get information about a file:

let file = File::open("images/test.iso")?;
let iso = ISO9660::new(file)?;
let obj = iso.open("GPL_3_0.TXT")?.expect("GPL_3_0.TXT doesn't exist");
println!("Last modified at: {:?}", obj.modify_time());

See Also

The examples.

Structs

Enums

Constants

  • The size of a filesystem block, currently hardcoded to 2048 although the ISO spec allows for other sizes.

Traits

  • A quick hack to allow for a constructor even though blocks are defined as a primitive type.
  • ExtraAttributes encapsulates various metadata specified by ISO-9660 / ECMA-119 extensions.
  • A trait for objects which can be read by logical block addresses.

Type Aliases