copyToDisk method
Copies the file at path to the same path on disk, or to to.
Implementation
Future<void> copyToDisk(String disk, String path, [String? to]) async {
// Checked first, so a missing file is reported against this disk rather
// than surfacing mid-stream as the target's error.
if (await missing(path)) throw DiskFileNotFoundException(path, disk: name);
await FileStorage.disk(disk).put(to ?? path, readStream(path));
}