Cordova: how to correctly work with files?

Hey everyone,

After days of useless research (I’ve tried all possible tutorials on the Internet, Github 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 (question is mine): http://stackoverflow.com/questions/33156697/filesystem-api-cordova-file-is-created-but-cant-be-written

Any help / reference to working tutorial is greatly appreciated!

Bests