JSPM

openports

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 29
  • Score
    100M100P100Q56013F
  • License MIT

Find multiple open ports

Package Exports

  • openports

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 (openports) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

openports

Find multiple open ports.

Installation

npm install --save openports

Usage

/**
 * Returns n open ports. Uses port 0 for port discovery, and binds to all ports
 * prior to releasing them to help avoid race conditions. Accepts an optional
 * callback, otherwise it returns a promise.
 *
 * @param   {int}      n    Number of ports to open
 * @param   {function} [fn] Optional callback to invoke
 * @returns {Promise}  An array of port numbers
 */

Example

var openports = require('openports');

openports(1, function(err, ports) {
  console.log(ports); // [12345]
});

openports(2).then(function(ports) {
  console.log(ports); // [12345, 12346]
});