Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fibjs-modules/detect-port
JavaScript Implementation of Port Detector
https://github.com/fibjs-modules/detect-port
detect-port detector fibjs port
Last synced: about 1 month ago
JSON representation
JavaScript Implementation of Port Detector
- Host: GitHub
- URL: https://github.com/fibjs-modules/detect-port
- Owner: fibjs-modules
- License: mit
- Created: 2017-03-17T06:21:13.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-18T17:52:17.000Z (over 6 years ago)
- Last Synced: 2024-10-05T19:52:34.665Z (3 months ago)
- Topics: detect-port, detector, fibjs, port
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
- awesome - detect-port - JavaScript Implementation of Port Detector. (Packages / Network)
README
# @fibjs/detect-port
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![appveyor build status][appveyor-image]][appveyor-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url][npm-image]: https://img.shields.io/npm/v/@fibjs/detect-port.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@fibjs/detect-port
[travis-image]: https://img.shields.io/travis/fibjs-modules/detect-port.svg?style=flat-square
[travis-url]: https://travis-ci.org/fibjs-modules/detect-port
[appveyor-image]: https://ci.appveyor.com/api/projects/status/34hk280r11xavawl/branch/master?svg=true
[appveyor-url]: https://ci.appveyor.com/project/ngot/detect-port
[codecov-image]: https://img.shields.io/codecov/c/github/fibjs-modules/detect-port.svg?style=flat-square
[codecov-url]: https://codecov.io/github/fibjs-modules/detect-port?branch=master
[david-image]: https://img.shields.io/david/fibjs-modules/detect-port.svg?style=flat-square
[david-url]: https://david-dm.org/fibjs-modules/detect-port
[snyk-image]: https://snyk.io/test/npm/@fibjs/detect-port/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@fibjs/detect-port
[download-image]: https://img.shields.io/npm/dm/@fibjs/detect-port.svg?style=flat-square
[download-url]: https://npmjs.org/package/@fibjs/detect-portJavaScript Implementation of Port Detector
## Install
```bash
$ npm i @fibjs/detect-port --save
```## Usage
```js
const detectPort = require('@fibjs/detect-port');
const availablePort = detectPort();
```or
```js
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](https://github.com/fibjs-modules/detect-port/issues).
## License
[MIT](LICENSE)