# getport

> Find an open port to listen on.

Latest version **0.1.0** (published 2013-07-16) · BSD license · 0 weekly downloads

## Install

```sh
npm install getport
pnpm add getport
yarn add getport
bun add getport
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2013-07-16 |
| First published | 2013-07-16 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 32 |
| Author | Mikeal Rogers |
| Maintainers | mikeal |
| Keywords | port, open |

## Links

- npm: https://www.npmjs.com/package/getport
- Repository: https://github.com/mikeal/getport
- Issues: https://github.com/mikeal/getport/issues
- npm.io page: https://npm.io/package/getport

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

- 0.1.0 (latest) — 2013-07-16

## README

### getport

`npm install getport`

Find an open port to listen on.

#### `getport(function (e, port) {})``

```javascript
var getport = require('getport')
getport(function (e, p) {
  if (e) throw e
  server.listen(p)
})
```

*Note: getport uses a TCP client to check the ports and see if anyone has bound to them. If you do not have permission to bind to a port you may still get an error.*

#### `getport(start, function (e, port) {})`

```javascript
getport(5000, function (e, p) {
  if (e) throw e
  assert.equal(5000, p)
})
```

#### `getport(start, end, function (e, port) {})`

```javascript
getport(6000, 5999, function (e, p) {
  assert.ok(e)
})
```

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