Expand description
What a file is, for the Editor to pick a viewer before it reads anything: one stat and the first 8 KB. Content decides first (magic bytes, then text vs binary), the extension only settles what content leaves open.
The attachment classifier (attachments::kind) supplies the magic-byte
table. Its text test (“valid UTF-8, no NUL”) is too strict for an editor
— a CP1252 .ini file is text — so the text/binary rule here is its own:
a BOM, then the UTF-16 NUL-parity test, then any NUL, then the share of
WHATWG “binary data bytes”.
docs/specs/SPEC_EDITOR_REVAMP_UNIFIED_VIEWERS_2026_10_15.md §4.2, §5.3.
Structs§
- Probe
- What the probe found.
- Probed
Text - The text side of a probe: how the file is encoded, as far as the first bytes tell.
Constants§
- PROBE_
BYTES - How many bytes the probe reads from the start of the file.
Functions§
- probe_
bytes probe_pathon the first bytes, with the ZIP inspection injected (tests).- probe_
path - Probe the file at
path. - register
fileprobe: what a file is (kind, MIME, text or binary), from one stat and its first 8 KB, so the Editor picks a viewer before reading it. This computer’s files only: an editor on an SSH host reads as text.