Skip to main content

Module extract

Module extract 

Source
Expand description

Shared archive open + extraction logic used by both the CLI (sit verb) and the GUI archive-browse tab.

Structs§

ExtractStats
Result of an extraction run.

Enums§

ForkFormat
Container format for an extracted file’s forks.

Functions§

extract_all
Extract every file in archive to dest, rebuilding the directory tree. progress(done, total, name) is called before each file entry.
extract_filtered
Like extract_all but only writes entries for which keep(idx) returns true (where idx indexes into archive.entries). Folder markers are always written so the rebuilt tree is rooted correctly; file entries the predicate rejects increment neither files nor skipped and don’t show up in the progress callback. Used by the GUI Archives tab’s “Extract Selected…” button (Workflow D.3).
is_stuffitx
Detect the StuffIt X container (“StuffIt!” / “StuffIt?”). Distinct from StuffIt 5, whose 8th byte is a space (“StuffIt (c)1997…”).
open
Read an archive file and parse it, transparently BinHex-decoding a .sit.hqx wrapper and routing classic StuffIt (SIT!), StuffIt 5, and .sea to the right parser. Returns the decoded archive bytes (offsets in the entries are relative to these) plus the parsed directory.
open_bytes
Like open but from in-memory bytes (already-read file contents). Routes through super::detect::detect_mac_archive so detection is magic-driven rather than extension-driven: a loose .hqx carrying one Mac file is synthesized into a single-entry archive so the rest of the extract / browse path needs no special case.
write_entry
Write one extracted file’s forks to the host in the chosen container format.