Expand description
decmpfs — apply the operating system’s transparent per-file compression to a file
in place: macOS APFS (decmpfs), Linux btrfs, Windows NTFS. The kernel decompresses
on read, so the file keeps its logical size + exact contents and loads at near-native
speed while taking less space on disk.
compress_file(path) detects the filesystem, applies compression, then verifies the
kernel reads the bytes back identically — rolling back on any failure. probe(path)
is the detect-only / capability-reporting half.
Backends: btrfs (FS_COMPR_FL + the btrfs.compression property), NTFS
(FSCTL_SET_COMPRESSION), and macOS decmpfs (resource fork, kernel-roundtrip
verified); other targets report Unsupported.
Contract: every Outcome is a SUCCESS; Err is reserved for genuine I/O failures
that leave the file’s integrity unknown. An unsupported FS, a permission/lock issue,
an incompressible or too-large file are non-fatal Outcomes.
Panic-free invariant: the deny below keeps non-test code free of the obvious panic sources; all slice indexing is length-guarded.
Structs§
- Gate
- The install-time gate: an optional glob AND an optional size predicate. A file
matches only if BOTH present predicates pass (an absent half is vacuously true).
Gate::default()is the fleet default — glob**/*.node, no size floor.
Enums§
- Error
- Genuine failures only. A capability/permission gap is an
Outcome, not anError. - Gate
Parse Error - Why a
Gate/SizePredicatestring failed to parse. - Outcome
- What happened to the file. Only
Erris a hard failure. - Size
Predicate - A
>/>=comparison against a byte threshold. - Skip
Reason - Support
- Unsupported
Reason
Constants§
- DEFAULT_
GLOB - The fleet default — every native addon, regardless of size.
Functions§
- compress_
bytes - THE install-time entry point: write
contenttopathas an OS-compressed file in ONE pass — never a write-then-read-back-recompress. - compress_
file - THE entry point: detect → gate → apply → verify → rollback-on-failure. Idempotent. Never panics. Never corrupts the file.
- probe
- Detect-only, no mutation — for dry-run / capability reporting.