Synchronous and asynchronous in nodejs

technical talkiess
0

 




Synchronous and asynchronous in nodejs:- 

// syncromous :- isme line by line execution hota hai


// asyncromus :- line by line execution nahi hota hai .... callback run hota hai remaining code run hota hai



var fs = require('fs');

// ye hota hai syncronus isse jaab tak niche wali line execute nahi hogi taab tak niche wala code run nahi hoga


text = fs.readFileSync("test.txt",'utf-8');

console.log(text);

// isko bolte hai asyncronomus iske age ka code run hota rahenga agar ye time le bhi raha hai to

fs.readFile("test.txt",'utf-8',(err,data)=>{

  console.log(data)

});


console.log("Testing is done");


Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)