code: func ReplaceFile(fs utilfs.Filesystem, path string, data []byte) error {
  	// write data to a temporary file
  	tmpPath, err := WriteTmpFile(fs, path, data)
  	if err != nil {
  		return err
  	}
  	// rename over existing file
  	return fs.Rename(tmpPath, path)
  }
docs: // ReplaceFile replaces the contents of the file at `path` with `data` by writing to a tmp file in the same
  // dir as `path` and renaming the tmp file over `path`. The file does not have to exist to use ReplaceFile,
  // but the parent directory must exist.
  // Note ReplaceFile calls fsync.