1.0.0 • Published 2 years ago

@bash-commands/sleep v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

sleep

sleep command from bash ported to node.js

Installation

npm install --save @bash-commands/sleep

Usage

const sleep = require('@bash-commands/sleep');

// .... Your code here ....
function main() {
  try {
    // usage with default options
    sleep().then(() => {
      // ...
    }); // sleep for 1 second

    // usage with custom timeout
    sleep(10).then(() => {
      // ...
    }); // sleep for 10 seconds

    // usage with custom timeout and native_sleep
    sleep(10, true); // sleep for 10 seconds using native_sleep
  } catch (err) {
    console.error(err);
  }
}

Configuration (optional)

ParameterTypeDefaultDescription
durationnumber1Number of seconds to sleep for
native_sleepbooleanfalseShould use native bash sleep command

License

License: ISC