npm

Bring the best of OSS JavaScript development to your projects with npm Orgs - private packages & team management tools.Learn more »

gport

1.1.1 • Public • Published

gport build status

Gets the next available port on your localhost starting from the given port number.

const getPort = require('gport')
const http = require('http')
 
getPort(check)
function check(port) {
  console.log(port) // some available port
}

Installation

npm install gport

API

getPort(port, cb)

Quick and dirty way to find an open port number on your localhost. Super small as it doesn't include any huge dependencies like other port finder libs. Inspired by https://gist.github.com/mikeal/1840641

Parameters:
Name Type Argument Description
port Number <optional>

start port, will be increased until an open one is found, when not supplied a random port will be used

cb function

called back with the open port

Source:

generated with docme

License

MIT

install

npm i gport

Downloadsweekly downloads

9

version

1.1.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability