Created
August 22, 2017 14:52
-
-
Save niraj-shah/a07b6c40c6048022190dc392775724ac to your computer and use it in GitHub Desktop.
Deleting a file using the Cordova File Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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