port-numbers 7.1.0 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,37 +1,29 @@
1
1
  # port-numbers
2
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
3
 
4
- > Get information on network port numbers and services, based on [IANA's public listing](http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml).
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
5
 
6
6
  ### Usage
7
- ```
8
- npm i port-numbers
9
- ```
10
7
  ```js
11
- import {getService, getPort} from "port-numbers";
12
-
13
- getService(6379);
14
- // { name: 'redis', description: 'An advanced key-value cache and store' }
15
- getService(26257);
16
- // { name: 'cockroach', description: 'CockroachDB' }
17
- getService(123, 'udp');
18
- // { name: 'ntp', description: 'Network Time Protocol' }
8
+ import ports from "port-numbers";
19
9
 
20
- getPort('redis');
21
- // { port: 6379, protocol: 'tcp', description: 'An advanced key-value cache and store' }
22
- getPort('cockroach');
23
- // { port: 26257, protocol: 'tcp', description: 'CockroachDB' }
24
- getPort('ntp', 'udp');
25
- // { port: 123, protocol: 'udp', description: 'Network Time Protocol' }
10
+ ports["6379/tcp"];
11
+ // ["redis", "An advanced key-value cache and store"]
12
+ ports["123/udp"];
13
+ // ["ntp", "Network Time Protocol"]
26
14
  ```
27
15
 
28
16
  ### API
29
- #### getService(port[, protocol])
30
- - `port` *Number* : the port to lookup. Required.
31
- - `protocol` *String* : the protocol. Default: `tcp`.
32
17
 
33
- #### getPort(service[, protocol])
34
- - `service` *String* : the service to lookup. Required.
35
- - `protocol` *String* : the protocol. Default: `tcp`.
18
+ The export is a JSON object in with `port/proto` as key and `[name, description]` as value.
19
+
20
+ ```json
21
+ {
22
+ "6379/tcp": [
23
+ "redis",
24
+ "An advanced key-value cache and store"
25
+ ]
26
+ }
27
+ ```
36
28
 
37
29
  © [silverwind](https://github.com/silverwind), distributed under BSD licence