eaptain-getport
v3.1.1
Published
Get an available port
Downloads
7
Maintainers
Readme
get-port
Get an available port
Install
$ npm install --save get-port
Usage
const getPort = require('get-port');
getPort().then(port => {
console.log(port);
//=> 51402
});
Optionally, pass in a preferred port:
getPort(3000).then(port => {
console.log(port);
// Will use 3000 if available, otherwise fall back to a random port
});
Related
- get-port-cli - CLI for this module
License
MIT © Sindre Sorhus