access files from assets/www directory

You can’t do what you want to do. The files in the assets directory are not technically on the file system so they are not accessible via the File API. This means calling window.resolveLocalFileSystemURI() will not return you a FileEntry.

The best you can hope for is to access those files via XHR. If they are text based you can always take the result of the XHR and write it to the file system using the FileWriter. I wrote a blog post that shows how to get a file from the assets directory using XHR.

http://simonmacdonald.blogspot.com/2011/12/on-fourth-day-of-phonegapping-creating.html

Leave a Comment