var fs = require('fs'); fs.writeFile("file.js", "alert('hello')", function(err) { if(err) throw err; console.log("The file was created!"); });