Open Ning2018 opened 6 years ago
From multiple resources: File System: The fs module provides an API for interacting with the file system in a manner closely modeled around standard POSIX functions.
call back function example
var fs = require(“fs"); fs.readFile('input.txt', function(err,data){ if(err) return console.error(err); console.log(data.toString()); }); console.log("Program Ended");
//function(err, data) is called back when finishing reading the file.
From multiple resources: File System: The fs module provides an API for interacting with the file system in a manner closely modeled around standard POSIX functions.
call back function example
var fs = require(“fs"); fs.readFile('input.txt', function(err,data){ if(err) return console.error(err); console.log(data.toString()); }); console.log("Program Ended");
//function(err, data) is called back when finishing reading the file.