Node.js fs writeFile() with callback function
writeFile()
var fs = require("fs"); fs.writeFile("./files/async.txt", "Hello world again!", function(error) { console.log("File has been written"); });//w ww .j av a 2s . c om console.log("Carry on executing");