Nominally Patriotic Meathead

    openports

    0.0.1 • Public • Published

    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]
    });

    Install

    npm i openports

    DownloadsWeekly Downloads

    11

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • danielstjules