Documentation
¶
Overview ¶
Package diskspace provides a single, reusable free-disk-space check (statfs's Bavail, the same "free space an unprivileged user could actually write" number GET /api/v1/system/doctor's disk_space check and GET /api/v1/system/status already surface), so disk-heavy operations elsewhere in this codebase (BuildKit builds, backup bookkeeping) can gate on it without reimplementing the syscall.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Free ¶
Free reports the bytes free at path that an unprivileged user could write, per statfs's Bavail field (not Bfree, which includes root-reserved blocks).
func HumanBytes ¶
HumanBytes renders bytes the same way web/src/lib/format.ts's own formatBytes does (binary units, one decimal place under 10 of a unit, none at or above), so a value read from Free and one read from the dashboard's own API response read the same regardless of which side rendered it. Negative bytes render as "0 B" rather than a negative unit, since this only ever wraps a real filesystem free-space value.
Types ¶
This section is empty.