Expand description
MacBinary I / II / III — the canonical full-fidelity parser for the family.
MacBinary is a transport wrapper: it serializes exactly one Mac file’s
data fork + resource fork + Finder metadata into a single flat stream. It
is not a multi-file archive, so it joins the macarchive family as a
single-entry StuffItArchive (see
super::extract::open_bytes).
This module replaces the full-fidelity parser that used to live buried in
the put-macbinary CLI verb. The lean resource_fork::parse_macbinary
remains a separate, deliberately conservative host-sidecar import
detector (it returns an ImportedResourceFork and only accepts
CRC-validated II/III with a non-empty resource fork). The two have distinct
roles; this one is the format reader.
Format reference: docs/native_mac_archives.md §2 (embedded spec).
§Two entry points
is_macbinary— the confidence-scored §2.4 detection heuristic, used by the content classifier. Strict on purpose: MacBinary I has no magic and lazy II writers zero the CRC, so a false positive would hijack an unrelated.bin.parse— lenient structural parse for a buffer already believed to be MacBinary (e.g. a user-suppliedput-macbinaryinput). Does not require a valid CRC, and accepts an empty resource fork (data-fork-only Mac files — a wrapped disk image, a text file — are legitimate MacBinary; the oldresource_forkparser wrongly rejected them).
Structs§
- MacBinary
File - One Mac file recovered from a MacBinary stream: both forks plus the full Finder metadata the header carries.
Enums§
- MacBinary
Version - Which MacBinary revision a stream identifies as.
Functions§
- is_
macbinary - Classify
bytesas MacBinary using the confidence-scored §2.4 heuristic. Returns the identified version, orNone. - parse
- Parse a buffer believed to be MacBinary into a
MacBinaryFile. Lenient: no CRC enforcement (some legacy II archives carry garbage there) and an empty resource fork is accepted. Useis_macbinaryfirst for content-driven detection.