Updated code to work with new cordova file plugin