Ads

Friday, 25 October 2013

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);  
 });  

No comments:

Post a Comment