This is my first article about NodeJS, I am currently exploring it and problems which I found during my learning sessions, I will share it to you with my blog posts.
Today while writing some code, I come across the need of sleep functionality between two transactions. While doing google, I found "sleep" library which provide required functionality.
Calling of sleep method is simple e.g.,
sleep.sleep(1) // time will be defined in seconds
But before that you need sleep library / package. To download it, use following npm command
npm install sleep
After successful installation, write following code to test this functionality.
var sleep = require('sleep');
sleep.sleep(1); //times in seconds.
and save this code in myExample.js file.
Execute the file with following command
Congratulations...... You have achieved the goal.
That's all for now folks..... If this post help you then please increase its credibility by posting your comments.