You can use something like Google Gears to produce JS applications which are capable of storing data in a local cache or database. You can't read or write arbitrary areas of the disk though. (This was written in 2009 - Google Gears is now deprecated)
These days, you should be looking at the local storage capabilities provided by HTML5
You can in Windows Scripting Host.
Next version of chrome (v52) made this possible with fetch api + service worker + streams, you can enable streams now with a flag...
you can go to the StreamSaver.js to see some examples of how to use it.
You can do something like this:
const writeStream = fs.createWriteStream('filename.txt') const encoder = new TextEncoder let data = 'a'.repeat(1024) let uint8array = encoder.encode(data + "\n\n") writeStream.write(uint8array) writeStream.close()
Or just go ahead and look at the demos: https://jimmywarting.github.io/StreamSaver.js/example.html
Edit: AS the above post states, it could be possible if your engine allowed it, however I don't know of one browser engine (which is what I asusme you are writing it for) that will allow you to.
If you just need to let user download a file (
.csv, images and others) via browser download dialog, you can use data URIs with
<a href=... download=.../> tag.
For example (for text file):
<a href="data:text/plain;charset=utf-8,TEXT_HERE" download="filename.txt"> Click to download </a>
You can also set the attribute
element.click() to trigger the download.
However, this method cannot write a file without user confirming the file download dialog.
©2020 All rights reserved.