gport
Gets the next available port on your localhost starting from the given port number.
Last updated 4 years ago by thlorenz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gport 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.1.1                                ...           latest (4 years ago)

6 Versions

  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |