Node.js is the best for this. It gives you acces to your local file system.
Example:
var fs = require('fs');
fs.writeFile("/tmp/test.txt", "Hey there!", function(err) {
if(err) {
console.log(err);
} else {
console.log("The file was saved!");
}
});
solved How to write a text file on server using JavaScript? [closed]