Skip to main content

archive_core/
lib.rs

1//! `archive_core` — a pure-Rust, `forbid(unsafe)`, read-only **archive layer**
2//! reader for forensics.
3//!
4//! An archive is treated as a transparent optional *archive layer*: `foo.E01.gz`
5//! resolves identically to `foo.E01`. [`peel_bytes`] removes one archive layer
6//! when present, so a consumer can recurse until it reaches the real evidence.
7//!
8//! Format determination follows the settled model: the **content magic** is the
9//! authority for the compression codec actually applied (you cannot gzip-decode
10//! bzip2 bytes), while the **file name** is a secondary hint used for aliases
11//! (`.tgz`→gzip+tar) and the magic-absent formats. See [`sniff`].
12//!
13//! Codec coverage grows incrementally; gzip is wired first (the canonical
14//! `E01.gz` archive layer). Large-member streaming / temp-spill (for multi-GB
15//! inner evidence) is the next hardening step — today the peel is in-memory with
16//! a hard output cap.
17#![cfg_attr(test, allow(clippy::unwrap_used, clippy::expect_used))]
18
19mod archive;
20mod archive_layer;
21mod detect;
22mod error;
23mod execute;
24mod peel;
25mod plan;
26mod reassemble;
27mod resolve;
28#[cfg(feature = "vfs")]
29mod vfs;
30
31pub use archive::{Archive, ArchiveEntry};
32pub use archive_layer::{peel_archive, Peel};
33pub use detect::{sniff, Format};
34pub use error::{ArchiveError, Result};
35pub use execute::{
36    peel_archive_seekable, PeelSource, PeeledSource, ReadSeek, SubRange, TempBacked,
37};
38pub use peel::{peel_bytes, PeelOutcome};
39pub use plan::{detect, Access, AccessPlan, Codec, Segment, SegmentKind};
40pub use reassemble::{reassemble, segment_sources, ConcatSource, Reassembled, SegmentSources};
41pub use resolve::{resolve, Limits, Node};
42#[cfg(feature = "vfs")]
43pub use vfs::ArchiveOpener;