Skip to main content

write_atomically

Function write_atomically 

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

Atomically replace path with bytes via a same-directory temp file.

Single owner for the create-dir / prefixed-tempfile / sync / rename dance that all KeyHog state artifacts, caches, and scanner artifacts persist through. A parentless or empty path resolves to the current directory (.) so a bare output filename saves cleanly instead of failing create_dir_all("").