I need to read multiple files into a single function A. I need to use FileAPI for it.
But FileReader performs an asynchronous download.
Can I get the contents of all files at the end of function A without exiting, or not?
I need to read multiple files into a single function A. I need to
Share
Just to be perfectly clear,
FileReaderisn’t downloading anything. It is asynchronously reading the File contents (as it appears on disk) into memory.To do what you want, just keep track of the read files and call a callback when they’re all done:
Try it: http://jsbin.com/epatel/3/edit#html,live