Site icon TechnologiesPosts

node.js Convert Blocking

Everyone don’t knows why important to write non-blocking programs in Node.js. Here is some code using non-blocking function “readFile()

Read the contents of ‘index.html’ and log them to the console.

 var fs = require('fs');  
 fs.readFile('index.html', function(err, contents){  
  console.log(contents);  
 });  
Share your Love
Exit mobile version