Can you read files in www folder using PhoneGap. JS methods?

Using JavaScript (not native code), is it possible to read folders and files from the www folder, where, for example, phonegap.js is?

I was able to read the contents of the file using AJAX calls, but I would like to know if there is another way. In addition, you cannot read such folders.

From what I saw, the File and FileEntry that PG provides only work with permanent or temporary disk locations. It seems I can not indicate any location that I want.

So, is there a way to do this using JS?

+1
file filesystems cordova
source share
2 answers

No, you cannot do this with FileReader, since it can only read from the file system. For files in your application, they are not actually in the file system, and you will need to use XHR to read them.

However, I recently wrote the XhrFileReader interface so you can use typical FileReader methods, but still read the files packaged with your application.

http://simonmacdonald.blogspot.ca/2013/02/phonegap-android-xhrfilereader.html

+1
source share

You may be looking for a FileReader object.

0
source share

All Articles