It would be useful if storage.move() supported overwriting the destination file, similar to upload().
Current behavior:
await storage.move(
"avatar_temp.jpg",
"avatar.jpg",
);
If avatar.jpg already exists, the move fails with a duplicate error. The current workaround is:
await storage.remove(["avatar.jpg"]);
await storage.move("avatar_temp.jpg", "avatar.jpg");
Proposed API:
await storage.move(
"avatar_temp.jpg",
"avatar.jpg",
fileOptions: const FileOptions(upsert: true),
);
or
await storage.move(
"avatar_temp.jpg",
"avatar.jpg",
overwrite: true,
);
This would make move() consistent with upload(), reduce API calls, and simplify common file replacement workflows.
KiddoV requests the addition of upsert/overwrite support to the storage.move() function. Currently, moving a file to a destination that already exists results in a duplicate error. The user suggests adding options to overwrite existing files, similar to the upload() function, to streamline workflows and reduce API calls.