pub struct DarReader<R>{ /* private fields */ }Expand description
Read-only DAR archive reader.
Implementations§
Source§impl<R> DarReader<R>
impl<R> DarReader<R>
pub fn open(reader: R) -> Result<DarReader<R>, DarError>
Sourcepub fn entry_count(&self) -> usize
pub fn entry_count(&self) -> usize
Number of catalogue entries, in O(1) — without materialising or cloning the entry list (cheap even for a multi-hundred-thousand-entry archive).
Sourcepub fn iter_entries(&self) -> impl Iterator<Item = DarEntry>
pub fn iter_entries(&self) -> impl Iterator<Item = DarEntry>
Sourcepub fn entries(&self) -> Vec<DarEntry>
pub fn entries(&self) -> Vec<DarEntry>
List all archived file entries (path and uncompressed size).
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Whether the catalog was parsed to a clean end.
false means parsing stopped early — typically at a catalog entry type
this reader does not model (e.g. a hardlink or device node) or at
corruption — so entries may be an incomplete listing.
A forensic caller should treat an incomplete listing as “more may exist”.
Sourcepub fn verify<P>(&mut self, path: P) -> Result<CrcStatus, DarError>
pub fn verify<P>(&mut self, path: P) -> Result<CrcStatus, DarError>
Verify a file entry’s data against the CRC stored in the catalogue,
decompressing the entry as needed. Returns CrcStatus::Match,
CrcStatus::Mismatch, or CrcStatus::NotStored. Unlike a
verify-on-extract design, this never refuses to hand over the bytes —
a forensic caller can still extract data that fails
its CRC in order to examine the corruption.
Sourcepub fn extract_to<P, W>(
&mut self,
path: P,
out: &mut W,
) -> Result<u64, DarError>
pub fn extract_to<P, W>( &mut self, path: P, out: &mut W, ) -> Result<u64, DarError>
Extract a file by path, streaming its (decompressed) bytes to out and
returning the number of bytes written. Unlike extract,
this never holds the whole file in memory, so it is safe for multi-GiB
entries (and composes with hashing, scanning, or writing to disk).
Source§impl DarReader<SliceReader>
impl DarReader<SliceReader>
Sourcepub fn open_slices(basename: &Path) -> Result<DarReader<SliceReader>, DarError>
pub fn open_slices(basename: &Path) -> Result<DarReader<SliceReader>, DarError>
Open a multi-volume (sliced) archive from its basename: base resolves
base.1.dar, base.2.dar, … until a slice is missing. The catalogue
lives in the last slice and entry data may span slices — both are handled
transparently. Errors if no base.1.dar exists.