copy static method

FutureResult<(), IoError> copy(
  1. Path from,
  2. Path to
)

Copies this file.

If to is a relative path, it is resolved against the current working directory (Env.currentDirectory).

If to identifies an existing file, that file is removed first. If to identifies an existing directory, the operation fails and the future completes with an IoError.

Implementation

static FutureResult<(), IoError> copy(Path from, Path to) async {
  return await Fs.ioGuard(
      () async => File(from.asString()).copy(to.asString())).map((_) => ());
}