/*
There is no way to let Javascript directly create/edit files since it presents a massive security problem.
But it can only read them.
Meanwile at node.js(still js in practicality but for servers), you can do both but you need to understand how it works to fully use it.
*/
// JS(Read Only)
let jsrefstring;
document.getElementById('test_1')
.addEventListener('change', function() {
var fr=new FileReader();
fr.onload=function(){jsrefstring = (fr.result).toString();}
fr.readAsText(this.files[0]);
});
//node.js, read only
const fs = require("fs");
fs.readFileSync("test.txt");
//node.js, overwrite
const fs = require("fs");
fs.open('test.txt', 'test', function (err, file) {if (err) throw err;});
// node.js, add new characters to file
const fs = require("fs");
fs.readFileSync("test.txt", "utf8");
fs.appendFile("test.txt", "test", function (err){ if (err) {throw err;}
})