Skip to main content

write_atomic

Function write_atomic 

Source
pub fn write_atomic(root: &Path, filename: &str, bytes: &[u8]) -> Result<()>
Expand description

Atomically replace <root>/<filename> with bytes, durably.

Writes a .tmp sibling, fsyncs it, renames it over the target, then fsyncs the directory so the rename itself survives a cut and not just the bytes it points at.