Skip to main content

write_atomic_private

Function write_atomic_private 

Source
pub fn write_atomic_private(
    path: &Path,
    contents: impl AsRef<[u8]>,
) -> Result<()>
Expand description

Atomically replace path with contents, creating the replacement file with owner-only permissions (0600) before any contents are written on Unix. For secrets: unlike write-then-chmod there is no window where the bytes exist world-readable.