1 | # port-numbers
|
2 | [![](https://img.shields.io/npm/v/port-numbers.svg?style=flat)](https://www.npmjs.org/package/port-numbers) [![](https://img.shields.io/npm/dm/port-numbers.svg)](https://www.npmjs.org/package/port-numbers) [![](https://packagephobia.com/badge?p=port-numbers)](https://packagephobia.com/result?p=port-numbers)
|
3 |
|
4 | npm module that holds information on network port numbers based on [IANA's data](http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml).
|
5 |
|
6 | ### Usage
|
7 |
|
8 | Depending on your environment you may need to use [import attributes](https://github.com/tc39/proposal-import-attributes), [import assertions](https://nodejs.org/api/esm.html#import-assertions) or [nothing at all](https://bun.sh/guides/runtime/import-json).
|
9 |
|
10 |
|
11 | ```js
|
12 | import ports from "port-numbers";
|
13 |
|
14 | ports["6379/tcp"];
|
15 | // ["redis", "An advanced key-value cache and store"]
|
16 | ports["123/udp"];
|
17 | // ["ntp", "Network Time Protocol"]
|
18 | ```
|
19 |
|
20 | ### API
|
21 |
|
22 | The export is a JSON object in with `port/proto` as key and `[name, description]` as value.
|
23 |
|
24 | ```json
|
25 | {
|
26 | "6379/tcp": [
|
27 | "redis",
|
28 | "An advanced key-value cache and store"
|
29 | ]
|
30 | }
|
31 | ```
|
32 |
|
33 | © [silverwind](https://github.com/silverwind), distributed under BSD licence
|