Reputation: 4351
As far as I can tell, there's no library call to replace a file (or folder). If I use FileEntry.copyTo
or DirectoryEntry.copyTo
and the destination exists, then I get INVALID_MODIFICATION_ERR
(error 9).
If I delete the file first, then copyTo
works. But what if something goes wrong? Is there an overwrite option I've missed somewhere? Or do I have to write my own code to ensure that the copy is successful before removing the original?
Upvotes: 4
Views: 3428
Reputation:
You can add the exclusive: false
option parameter to overwrite existing files.
Example https://github.com/apache/cordova-plugin-file/blob/master/README.md#create-a-persistent-file-
Upvotes: 3