pub fn write_new_file(path: &Path, bytes: &[u8]) -> Result<()>Expand description
Write bytes to a freshly created file at path, failing if anything already exists there.
Uses create_new so the write cannot follow a pre-existing symlink planted at the
destination (which could otherwise redirect artifact bytes outside the run directory) and
cannot clobber an existing file. On Unix the file is created with 0o600 so artifact
material is not world-readable.
ยงErrors
Returns the I/O error if the file exists or cannot be written and synced.