copy static method
Future<void>
copy(
- String from,
- String to, {
- UStorageBucket bucket = UStorageBucket.support,
- UStorageBucket? toBucket,
Implementation
static Future<void> copy(String from, String to, {UStorageBucket bucket = UStorageBucket.support, UStorageBucket? toBucket}) async {
await _ensure();
final UStorageEntry? source = _live(from, bucket);
if (source == null) return;
final UStorageBucket target = toBucket ?? bucket;
if (target == bucket) {
await _backend.copy(_pathFor(bucket, from), _pathFor(target, to));
await _record(to, target, source.size, mimeType: source.mimeType, sha256: source.sha256, tags: source.tags);
} else {
await write(to, read(from, bucket: bucket), bucket: target, mimeType: source.mimeType, tags: source.tags);
}
}