Ning2018 / JavaFundamentals

0 stars 0 forks source link

Nodejs #11

Open Ning2018 opened 6 years ago

Ning2018 commented 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.