Skip to main content

DmgReader

Struct DmgReader 

Source
pub struct DmgReader<R> { /* private fields */ }
Expand description

DMG reader for parsing and extracting disk images

Implementations§

Source§

impl<R: Read + Seek> DmgReader<R>

Source

pub fn new(reader: R) -> Result<Self>

Create a new DMG reader with default options (checksum verification enabled)

Source

pub fn with_options(reader: R, options: DmgReaderOptions) -> Result<Self>

Create a new DMG reader with custom options

Source

pub fn koly(&self) -> &KolyHeader

Get the koly header

Source

pub fn partitions(&self) -> &[PartitionEntry]

Get all partitions

Source

pub fn partition(&self, name: &str) -> Option<&PartitionEntry>

Get partition by name

Source

pub fn list_partitions(&self) -> Vec<&str>

List all partition names

Source

pub fn stats(&self) -> DmgStats

Get DMG statistics

Source

pub fn decompress_partition(&mut self, partition_id: i32) -> Result<Vec<u8>>

Decompress a specific partition to raw disk data

Source

pub fn decompress_partition_to<W: Write>( &mut self, partition_id: i32, writer: &mut W, ) -> Result<u64>

Decompress a partition and stream to a writer block-by-block. Only uses ~block_size memory per block instead of buffering the full partition. Integrity is ensured by koly checksums verified on open. Returns the total number of bytes written.

Source

pub fn decompress_main_partition(&mut self) -> Result<Vec<u8>>

Decompress the main HFS+ partition (largest one)

Source

pub fn decompress_main_partition_to<W: Write>( &mut self, writer: &mut W, ) -> Result<u64>

Stream the main HFS+/APFS partition to a writer.

Source

pub fn main_partition_id(&self) -> Result<i32>

Find the partition ID of the main HFS+/APFS partition.

Source

pub fn hfs_partition_id(&self) -> Result<i32>

Find the partition ID of the main HFS+/HFSX partition (excludes APFS). Returns Err(FileNotFound) if no HFS-compatible partition exists.

Source

pub fn decompress_all(&mut self) -> Result<Vec<u8>>

Decompress all partitions into a single raw disk image

Source

pub fn decompress_partition_auto( &mut self, partition_id: i32, ) -> Result<Vec<u8>>

Decompress a specific partition to raw disk data.

Automatically uses parallel decompression when the parallel feature is enabled.

Source

pub fn decompress_main_partition_auto(&mut self) -> Result<Vec<u8>>

Decompress the main HFS+ partition using auto-selected strategy.

Source

pub fn decompress_main_partition_to_auto<W: Write>( &mut self, writer: &mut W, ) -> Result<u64>

Stream the main HFS+/APFS partition to a writer, using auto-selected strategy.

Source

pub fn compression_info(&self) -> CompressionInfo

Get info about block compression types used

Source§

impl DmgReader<BufReader<File>>

Source

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>

Open a DMG file from a path with default options (checksum verification enabled)

Source

pub fn open_with_options<P: AsRef<Path>>( path: P, options: DmgReaderOptions, ) -> Result<Self>

Open a DMG file from a path with custom options

Auto Trait Implementations§

§

impl<R> Freeze for DmgReader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for DmgReader<R>
where R: RefUnwindSafe,

§

impl<R> Send for DmgReader<R>
where R: Send,

§

impl<R> Sync for DmgReader<R>
where R: Sync,

§

impl<R> Unpin for DmgReader<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for DmgReader<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for DmgReader<R>
where R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.