I was trying to read and write a file in javascript. Nodejs 'fs'is not working. I came to know that there is an equivalent HTML5 API's.
What is the equivalent for
fs.writeFile('my.file', filedata)
fs.readFileSync(__dirname + '/dir/leaves.file')
in HTML5 filereader api
fsequivalent in web APIs, for obvious security reasons.fs->filesystem, and browsers won't give access to the user's filesystem to any random script on the web. You can read files with a FileReader, you can load files from a server with XHR, or you can ask your user to give you files from their f-s, and you can prompt your user to save files. But none of these operations will be done directly from the user's file-system, without his action. (*well actually we could consider IndexedDB and alike as filesystems...)