node package manager
Love JavaScript? Your insights can make it even better. Take the 2017 JavaScript Ecosystem Survey ยป



Add sleep(), msleep() and usleep() to Node.js, via a C++ binding.

This is mainly useful for debugging.

These calls will block execution of all JavaScript by halting Node.js' event loop!


var sleep = require('sleep');
  • sleep.sleep(n): sleep for n seconds
  • sleep.msleep(n): sleep for n miliseconds
  • sleep.usleep(n): sleep for n microseconds (1 second is 1000000 microseconds)