Node.js fs write async text file

Description

Node.js fs write async text file


var fs = require("fs");

console.log("\nwriting to file 'write_sync.txt' ...\n");

// write to file asynchoronously
fs.writeFile("./files/write_async.txt", "Hello world! Asynchoronous!", function(error){
  console.log("Written file 'write_async.txt'... ");
});/*from ww  w . ja va 2 s  .co  m*/

console.log("done!\n");



PreviousNext

Related