Skip to main content

available_bytes

Function available_bytes 

Source
pub fn available_bytes(path: &Path) -> Option<u64>
Expand description

Free (available-to-this-user) bytes on the filesystem backing path.

Returns None when the probe fails (path doesn’t exist yet, an unsupported platform, a transient stat error). Callers treat None as “headroom unknown” and degrade to a no-op rather than abort — the guard must never manufacture a failure from a probe gap.

fs4::available_space reports the space available to an unprivileged process (statvfs f_bavail × f_frsize on unix, the caller-quota figure from GetDiskFreeSpaceExW on Windows) — the correct number for “will this write succeed”, as opposed to total free including root-reserved blocks.