# is-port-reachable

> Check if a local or remote port is reachable

Latest version **4.0.0** (published 2021-09-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-port-reachable
pnpm add is-port-reachable
yarn add is-port-reachable
bun add is-port-reachable
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2021-09-19 |
| First published | 2015-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 0 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 113 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus, silverwind |
| Keywords | port, reachable, local, remote, host, ip, localhost, address, connect, connectable, online, socket, tcp, is, check |

## Links

- npm: https://www.npmjs.com/package/is-port-reachable
- Repository: https://github.com/sindresorhus/is-port-reachable
- Homepage: https://github.com/sindresorhus/is-port-reachable#readme
- Issues: https://github.com/sindresorhus/is-port-reachable/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/is-port-reachable

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2021-09-19
- 3.1.0 — 2021-09-19
- 3.0.0 — 2019-11-12
- 2.0.1 — 2019-04-11
- 2.0.0 — 2016-09-09
- 1.0.0 — 2015-08-24

## README

# is-port-reachable

> Check if a local or remote port is reachable

## Install

```sh
npm install is-port-reachable
```

## Usage

```js
import isPortReachable from 'is-port-reachable';

console.log(await isPortReachable(80, {host: 'google.com'}));
//=> true
```

## API

### isPortReachable(options)

Returns `Promise<boolean>` for whether the port is reachable.

##### port

Type: `number`

The port to check.

#### options

Type: `object`

##### host

**Required**\
Type: `string`\
Example: `'localhost'`

The host to check.

Can be a domain (optionally, with a sub-domain) or an IP address.

##### timeout

Type: `number`\
Default: `1000`

The time to wait in milliseconds before giving up.

## Related

- [is-reachable](https://github.com/sindresorhus/is-reachable/) - Check if servers are reachable

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