Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

hashed-port

nak2k2MIT0.1.3TypeScript support: included

Get a port number with a hash function

readme

hashed-port

Get a port number with a hash function.

Installation

npm i hashed-port

Usage

const { getPort } = require('hashed-port');

getPort((err, port) => {
  ...
});

getPort([options, ]callback)

  • options
    • If this arg is a string, it is assumed options.key.
  • options.key
    • Any string to compute a port number.
    • If omitted, the environment variable npm_package_name is used. This is usefull for your CLI to has a default port number without conflicting with other applications.
  • callback(err, port)
    • A function that is called to return a gotten port number.

License

MIT