This is a topic that has come up a few times in comments recently but I wanted to post something a bit more explicit. First and foremost, you cannot use the File system APIs to work with files under the www folder. The docs for the File plugin incorrectly states that you have Read access to the application directory (which would contain www) but that is incorrect.
You can use XHR to read in files from under www. For text files this is rather trivial. For binary data you want to be careful before reading in large amounts of data. Remember that you can work with binary data via Ajax using XHR2 (spec and support levels).
Finally - one problem you may run into is supporting a dynamic list of files. Since you can't read the directory, if you want to support a random set of assets under www then you would need to ship a file that contains a list of those resources. You would then do an XHR to that file, get the list, and process as you see it.
Archived Comments
Hi, thank you for yours great articles!!!
-->> ... you can’t read the directory ...
https://github.com/007-sura...
This plugin allow me read list of files in my App
and what you mean resources files in cordova project, it's special status for files like "ResourceFiles"?
For example www/img it's usual content, but www/mySameFolder can be have status of "ResourceFiles"?
I didn't mean anything formal - just abstract.
)))!! I started looking into Google 'variants for including files in Cordova project'
Though, this question is more about possibilities of native platforms like IOS, Android ...