javascriptfilereaderfilewriter

Edit file - pure js


How do I edit a file in pure js (without node)? I get a file with an input field and I read its text like this:

var fileReader = new FileReader();
fileReader.readAsText(file);

fileReader.onload = function () {
    alert(this.result);
}

So, pretty straight forward. I tried to look on the net how to use a fileWriter but with no success. I just need to edit the text inside that file and save it, how can I do?


Solution

  • You can't write files in a browser, you'll have to use node.