Skip to content

Instantly share code, notes, and snippets.

@niraj-shah
Created August 22, 2017 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niraj-shah/a07b6c40c6048022190dc392775724ac to your computer and use it in GitHub Desktop.
Save niraj-shah/a07b6c40c6048022190dc392775724ac to your computer and use it in GitHub Desktop.
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