JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1937702
  • Score
    100M100P100Q200601F
  • License MIT

Get an available TCP port to listen

Package Exports

  • get-port-please

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (get-port-please) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

get-port-please

Get an available TCP port to listen

npm npm (scoped with tag)

Usage

Install package:

yarn add get-port-please
# or
or npm install get-port-please
const getPort = require('get-port-please')
// or
import getPort from 'get-port-please'
function getPort(options?: GetPortOptions): Promise<number>

Try sequence is: port > ports > memo > random

Options

interface GetPortOptions {
  name?: string

  random?: boolean
  port?: number
  ports?: number[]

  memoDir?: string
  memoName?: string
}

name

Unique name for port memorizing. Default is default.

random

If enabled, port and ports will be ignored. Default is false.

port

First port to check. Default is process.env.PORT || 3000

ports

Alternative ports to check. Default is [4000, 5000, 6000, 7000]

memoDir / memoName

Options passed to fs-memo

  • Default dir: node_modules/get-port/dist
  • Defalt name: .get-port

License

MIT