pub fn write_atomic(path: &Path, data: &[u8]) -> Result<()>
Atomic write: write to temp file in same dir, then rename.