Can anybody give some sample code to read and write a file using JavaScript?
Here is write solution for chrome v52+ (user still need to select a destination doe...)
source: StreamSaver.js
const writeStream = streamSaver.createWriteStream('filename.txt')
const encoder = new TextEncoder
let data = 'a'.repeat(1024)
let uint8array = encoder.encode(data + "\n\n")
writeStream.write(uint8array) // must be uInt8array
writeStream.close()
Best suited for writing large data generated on client side.
Otherwise I suggest using FileSaver.js to save Blob/Files