Node.js fs read text file with callback function

Description

Node.js fs read text file with callback function


var fs = require("fs");
console.log("Starting");
fs.readFile("./files/sample.txt", function(error, data) {
  console.log("Contents: " + data);
});/*from w  w w. j  a va  2 s . c  o  m*/



PreviousNext

Related