JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 37987
  • Score
    100M100P100Q147363F
  • License KINDLY

Limit the shell execution commands to <x> calls same time.

Package Exports

  • exec-limiter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (exec-limiter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

exec-limiter Donate now

Limit the shell execution commands to calls same time.

Installation

$ npm i exec-limiter

Example

// Dependencies
var ExecLimiter = require("exec-limiter");

// Constants
const COMMAND = "sleep 5; date;";

// Create an instance of exec limiter
var el = new ExecLimiter(10)
  , i = 0
  , c = 0
  ;

// Exec the command 30 times, but not more than 10 same time
for (; i < 30; ++i) {
    el.add(COMMAND, function (err, stdout) {
        console.log((++c) + "> " + stdout);
    });
}

Documentation

ExecLimiter(limit)

Creates a new instance of ExecLimiter.

Params

  • Number limit: The limit of commands to run same time.

Return

  • ExecLimiter The ExecLimiter instance.

add(command, options, callback)

Adds a new command to run in the buffer.

Params

  • String command: The command to run.
  • Object options: The options to pass to the exec function.
  • Function callback: The callback function.

Return

  • ExecLimiter The ExecLimiter instance.

How to contribute

Have an idea? Found a bug? See how to contribute.

License

KINDLY © Ionică Bizău–The LICENSE file contains a copy of the license.