I'm aware JS isn't a server side script, but I'm building a mobile app, and I'm going to use the web view controller on android and would like the ability to be able to read a file into an array using JS. Is there anyway of doing this?
Thanks
I'm aware JS isn't a server side script, but I'm building a mobile app, and I'm going to use the web view controller on android and would like the ability to be able to read a file into an array using JS. Is there anyway of doing this?
Thanks
You can use the HTML5 FileReader API. With it you can read the file as:
void readAsArrayBuffer(in Blob blob); //Requires Gecko 7.0
void readAsBinaryString(in Blob blob);
void readAsDataURL(in Blob file);
void readAsText(in Blob blob, [optional] in DOMString encoding);
Here are few examples.