Skip to main content

atomic_write

Function atomic_write 

Source
pub fn atomic_write(path: &Path, bytes: &[u8]) -> Result<()>
Expand description

Atomically write bytes to path via a sibling temp file + rename.

The temp file is created in the same directory as path so the final rename is atomic on the same filesystem. On Unix the file is created with 0o600 so setup-owned state never lands world-readable. Parent directories are created as needed.