checkFile in ng-cordova not working

cordova,

I'm liking ng-cordova. I use the downloadFile and it works perfectly. I use it like so:

$cordovaFile.downloadFile(source, 'cdvfile://localhost/persistent/myFolder/newFile.jpg', true).then(..)..

But when I use $cordovaFile.checkFile('cdvfile://localhost/persistent/myFolder/newFile.jpg').then(...), it always returns an error. It seems like it doesn't find the file.

Am I doing it correctly? How do we check for a file using ng-cordova? The docs are sparse but pretty self-explanatory so I'm not sure what else to do. http://ngcordova.com/docs/#File

Google Groups on Phonegap don't mention anything in this light. I've been testing different approaches and file/path referencing but nothing seemed to work. Any help would be much appreciated.

Thanks.

This answer's probably come a bit late to be useful to you, but I'll respond in the hopes that it'll be useful to people who find this question in future.

$cordovaFile.checkFile() actually takes two parameters, the directory you want to check in and the filename of the file you wish to check.

So your example should instead look like this: $cordovaFile.checkFile('cdvfile://localhost/persistent/myFolder','newFile.jpg').then(...)

A more generic example: $cordovaFile.checkFile(directory, filename)

And if you're using a cordova.file directory path such as cacheDirectory: $cordovaFile.checkFile(cordova.file.cacheDirectory,'example.txt')

Also worth noting is that there is no need for the slash between the directory and the file name, as this is put in by checkFile.