@fibjs/detect-port

1.0.2 • Public • Published

@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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    60
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    60
  • 1.0.1
    3
  • 1.0.0
    2

Package Sidebar

Install

npm i @fibjs/detect-port

Weekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

4.57 kB

Total Files

5

Last publish

Collaborators

  • ngot
  • ngot-fibjs