Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thlorenz/gport
Gets the next available port starting from the given port number.
https://github.com/thlorenz/gport
Last synced: 13 days ago
JSON representation
Gets the next available port starting from the given port number.
- Host: GitHub
- URL: https://github.com/thlorenz/gport
- Owner: thlorenz
- License: mit
- Created: 2016-02-04T16:30:55.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-05T09:10:33.000Z (almost 8 years ago)
- Last Synced: 2024-12-10T08:26:55.796Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://github.com/thlorenz/gport
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gport [![build status](https://secure.travis-ci.org/thlorenz/gport.png)](http://travis-ci.org/thlorenz/gport)
Gets the next available port on your localhost starting from the given port number.
```js
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/1840641Parameters:
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
*generated with [docme](https://github.com/thlorenz/docme)*
## License
MIT