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§

ExtraMeta
Holds information from system use (SUSP) entries.
ISO9660
Struct representing an ISO 9660 / ECMA-119 filesystem.
ISODirectory
DirectoryEntry for directories.
ISODirectoryIterator
Iterator for the contents of ISODirectory constructed by contents(). Similar to POSIX.1’s readdir.
ISOFile
DirectoryEntry for regular files.
ISOFileReader
A struct providing read-only access to a file on the filesystem.
PosixAttributes
POSIX.1 attributes from a PX entry.
PosixFileMode
The mode from a PX entry. Equivalent to POSIX.1’s st_mode field.
PosixTimestamp
Timestamps from a TF entry.
Symlink
DirectoryEntry for symbolic links. Typically generated from SL entries.

Enums§

DirectoryEntry
An entry inside of a directory on the filesystem. Returned by the ISODirectoryIterator iterator.
ISOError
The master error structure.
SuspExtension
System Use extensions registered as being used in a directory hierarchy

Constants§

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

Traits§

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

Type Aliases§

BlockBuffer
A u8 array big enough to hold an entire filesystem block.
Result
Result that returns an ISOError.