Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including port-numbers with all npm packages installed. Try it out:

var portNumbers = require("port-numbers")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

port-numbers v6.0.1

Get information on network port numbers and services, based on IANA's public listing

port-numbers

Get information on network port numbers and services, based on IANA's public listing.

Usage

npm i port-numbers
const {getService, getPort} = require('port-numbers');

getService(6379);
// { name: 'redis', description: 'An advanced key-value cache and store' }
getService(26257);
// { name: 'cockroach', description: 'CockroachDB' }
getService(123, 'udp');
// { name: 'ntp', description: 'Network Time Protocol' }

getPort('redis');
// { port: 6379, protocol: 'tcp', description: 'An advanced key-value cache and store' }
getPort('cockroach');
// { port: 26257, protocol: 'tcp', description: 'CockroachDB' }
getPort('ntp', 'udp');
// { port: 123, protocol: 'udp', description: 'Network Time Protocol' }

API

getService(port[, protocol])

  • port Number : the port to lookup. Required.
  • protocol String : the protocol. Default: tcp.

getPort(service[, protocol])

  • service String : the service to lookup. Required.
  • protocol String : the protocol. Default: tcp.

© silverwind, distributed under BSD licence

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free