Monday, 8 May 2017

Node.js ReadFile() function syntax explanation

Could someone please explain me the node.js ReadFile() function syntax? I don't understand why function(err,data) falls inside it. I'm totally new to programming. The example on node.js website is still confusing. thanks!

sample code from node.js website

fs.readFile('/etc/passwd', (err, data) => {
  if (err) throw err;
  console.log(data);
});



via Ranga RS

No comments:

Post a Comment