Function write_new_atomic

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

Writes a new sidecar through a temporary file, never replacing an existing one.

An interrupted download may leave a hidden temporary file, but never a truncated image or lyric at its final path. Publication uses a hard link on the same filesystem and fails closed if the filesystem cannot provide it: an existence check followed by rename could replace another writer’s file.