# addr-to-ip-port

> Convert an 'address:port' string to an array [address:string, port:number]

Latest version **2.0.0** (published 2022-11-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install addr-to-ip-port
pnpm add addr-to-ip-port
yarn add addr-to-ip-port
bun add addr-to-ip-port
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2022-11-16 |
| First published | 2014-09-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=12.20.0 |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | WebTorrent, LLC |
| Maintainers | alxhotel, feross, mafintosh, flet, watson, diegorbaquero, hicom150, jhiesey, webtorrent-bot |
| Keywords | convert, address, port, cache, string, array, ip, addr to ip port, webtorrent |

## Links

- npm: https://www.npmjs.com/package/addr-to-ip-port
- Repository: https://github.com/webtorrent/addr-to-ip-port
- Issues: https://github.com/webtorrent/addr-to-ip-port/issues
- npm.io page: https://npm.io/package/addr-to-ip-port

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

- 2.0.0 (latest) — 2022-11-16
- 1.5.4 — 2021-07-30
- 1.5.3 — 2021-07-23
- 1.5.2 — 2021-07-23
- 1.5.1 — 2018-07-26
- 1.5.0 — 2018-07-26
- 1.4.3 — 2018-02-23
- 1.4.2 — 2015-09-11
- 1.4.1 — 2015-04-11
- 1.4.0 — 2014-11-26
- 1.3.0 — 2014-11-26
- 1.2.0 — 2014-11-26
- 1.1.0 — 2014-11-26
- 1.0.1 — 2014-09-13
- 1.0.0 — 2014-09-13

## README

# addr-to-ip-port [![ci][ci-image]][ci-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]

[ci-image]: https://github.com/webtorrent/addr-to-ip-port/actions/workflows/ci.yml/badge.svg
[ci-url]: https://github.com/webtorrent/addr-to-ip-port/actions/workflows/ci.yml
[npm-image]: https://img.shields.io/npm/v/addr-to-ip-port.svg
[npm-url]: https://npmjs.org/package/addr-to-ip-port
[downloads-image]: https://img.shields.io/npm/dm/addr-to-ip-port.svg
[downloads-url]: https://npmjs.org/package/addr-to-ip-port
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com

#### Convert an "address:port" string to an array [address:string, port:number]

Uses a cache to prevent excessive array allocations and GC.

Works in node and the browser. This module is used by [WebTorrent](http://webtorrent.io)!

### install

```
npm install addr-to-ip-port
```

### usage

```js
import addrToIPPort from 'addr-to-ip-port'

addrToIPPort('1.2.3.4:8000') //=> ['1.2.3.4', 8000]
addrToIPPort('1.2.3.4:8000') //=> ['1.2.3.4', 8000] (returns the cached object)
```

### license

MIT. Copyright (c) [Feross Aboukhadijeh](https://feross.org) and [WebTorrent, LLC](https://webtorrent.io).

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