# @fibjs/detect-port

> JavaScript Implementation of Port Detector

Latest version **1.0.2** (published 2018-06-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fibjs/detect-port
pnpm add @fibjs/detect-port
yarn add @fibjs/detect-port
bun add @fibjs/detect-port
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-06-18 |
| First published | 2017-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | ngot |
| Maintainers | ngot, ngot-fibjs |
| Keywords | Detector, Port, Port Detector, fibjs |

## Links

- npm: https://www.npmjs.com/package/@fibjs/detect-port
- Repository: https://github.com/fibjs-modules/detect-port
- Homepage: https://github.com/fibjs-modules/detect-port#readme
- Issues: https://github.com/fibjs-modules/detect-port/issues
- npm.io page: https://npm.io/package/@fibjs/detect-port

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@oxyhq/services](https://npm.io/package/@oxyhq/services.md) — 2.3K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-06-18
- 1.0.1 — 2017-10-24
- 1.0.0 — 2017-03-17

## 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-port

JavaScript 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)

---
_Source: https://npm.io/package/@fibjs/detect-port · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
