Learn an easy way to delete a file (android,ios,windows) with cordova

Delete a file with cordova is really simple, just use the following code

var path = "file:///storage/emulated/0";
var filename = "myfile.txt";

window.resolveLocalFileSystemURL(path, function(dir) {
	dir.getFile(filename, {create:false}, function(fileEntry) {
                  // The file has been removed succesfully
                  // Error deleting the file
                 // The file doesn't exist

Remember that you need the file plugin from cordova, read and learn how to use it here.

You can download the file plugin with 

cordova plugin add cordova-plugin-file

Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.