Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Deleting a file using the Cordova File Plugin
// access the persistent file system
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fs) {
// get the file named "config.json"
fs.root.getFile("config.json", { create: false }, function(fileEntry) {
// attempt to remove the file if it exists
fileEntry.remove(function() {
// delete successful
console.info('Config file has been deleted successfully.');
}, function(error) {
// delete failed
console.error('Could not delete Config file. ' + JSON.stringify( error ));
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment