ngCordova readAsText not working


I’m using the code as documented on the ngCordova site but I’m unable to read a file as text. There no mention of what the filePath variable should contain.

In my case I’m trying to read the URL the camera returns as Camera.DestinationType.FILE_URI, being in the following format: file:///var/mobile/Containers/Data/Application/98BDEB32-05E5-43A0-ACF4-FCF5E15E4605/tmp/cdv_photo_023.jpg

Looks like a good file path to me and can even use that path to show the image in the cordova app, but I can’t read the file as text (and need it to create an md5 hash of the image)

Any help is greatly appreciated!

// Reads a file as TEXT
  $cordovaFile.readFile(filePath).then(function(result) {
      // Success! 
  }, function(err) {
      // An error occured. Show a message to the user

[NG Cordova] $cordovaFile.readFile fails

I’m not sure here, but I notice that the readFile or readAsText() method doesn’t succeed in loading the correct file.

I’m actually grabbing a picture from camera and as you can see in the URL the /tmp folder is used. Is that PERSISTENT storage or TEMPORARY storage?

I can see that the getfileSystem method in ngcordova uses window.requestFileSystem(LocalFileSystem.PERSISTENT,

I can change PERSISTENT to TEMPORARY and that removes my errors, but I’m getting “null” as a result from the readAsText() method now