copyAtomic function

void copyAtomic(
  1. File from,
  2. File file
)

Replaces file with a copy of from, as writeBytesAtomic writes: never seen half-written, through a symbolic link, and with from's permissions on macOS and Linux.

Implementation

void copyAtomic(File from, File file) =>
    _replaceAtomic(file, (temp) => from.copySync(temp.path), seed: false);