Skip to main content

write_file_atomic

Function write_file_atomic 

Source
pub fn write_file_atomic(path: impl AsRef<Path>, body: &str) -> Result<()>
Expand description

Atomically replace a file with fsynced contents.

The data is written to a sibling temp file, fsynced, renamed over the destination, then the parent directory is fsynced.