@fibjs/detect-port

JavaScript Implementation of Port Detector

Stats

StarsIssuesVersionUpdatedCreatedSize
@fibjs/detect-port
111.0.23 years ago5 years agoMinified + gzip package size for @fibjs/detect-port in KB

Readme

@fibjs/detect-port

NPM version build status appveyor build status Test coverage David deps Known Vulnerabilities npm download

JavaScript Implementation of Port Detector

Install

$ npm i @fibjs/detect-port --save

Usage

const detectPort = require('@fibjs/detect-port');
const availablePort = detectPort();

or

const detectPort = require('@fibjs/detect-port');
const port = 3000;
const availablePort = detectPort(port);
if (availablePort === port) {
  console.log(`port ${port} is available!`);
} else {
  console.log(`port ${port} is not available! Got a random available port: ${availablePort} for you.`);
}

Questions & Suggestions

Please open an issue here.

License

MIT

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.