try-ports
v1.0.2
Published
try port eg. 8888, if in use try port +1, rinse and repeat.
Downloads
4
Readme
npm-try-ports
try port eg. 8888, if in use try port +1, rinse and repeat.
usage
npm i try-ports
or
npm i -D try-ports
const tryPorts = require("try-ports");
tryPorts(8888, port => {
// callback with port equal to whatever port was free, starting at 8888
// rest of your code goes here
}