Choose an available port
npm install choose-port
or
yarn add choose-port
Call Async
const choosePort = require('choose-port');
choosePort(8000, '127.0.0.1', portValid => {
console.log('Chosen port:', portValid);
});
Call Sync
const { choosePortSync } = require('choose-port');
const portValid = choosePortSync(8000, '127.0.0.1');
console.log(portValid);
Download stats for this NPM package
Choose Port is open source software licensed as MIT.