1

After days of useless research (I've tried all possible tutorials and code snippets on the Internet, Github, SO etc.) I'm desperately looking for a way to use Cordova file plugin to:

  • read a text / json file
  • write a text file

In most of my attemps I get fileErrror error codes 1 and 5. Also, I'm not sure whether I should create a directory assets, or public or whatever.

I'm using Crosswalk package. An example of code I've tried out: https://stackoverflow.com/questions/33156697/filesystem-api-cordova-file-is-created-but-cant-be-written

Community
  • 1
  • 1
dragonmnl
  • 14,578
  • 33
  • 84
  • 129

1 Answers1

0

Instead of window.requestFileSystem(), try using window.resolveLocalFileSystemURL(). That worked for me.

Full explanation here: FileError {code: 5} trying to use absolute file paths with Meteor 1.4 Cordova

Example code here: https://github.com/meonkeys/cordova-file-test/tree/solution

Adam Monsen
  • 9,054
  • 6
  • 53
  • 82