get-port-plz

Get an available TCP port to listen

Please use https://www.npmjs.com/package/get-port-please
Last updated 8 months ago by pi0 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install get-port-plz 
SYNC missed versions from official npm registry.

get-port-plz

Get an available TCP port to listen

npm npm (scoped with tag)

Usage

Install package:

yarn add get-port-plz
# or
or npm install get-port-plz
const getPort = require('get-port-plz')
// or
import getPort from 'get-port-plz'
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

Current Tags

  • 0.0.6                                ...           latest (8 months ago)

5 Versions

  • 0.0.6 [deprecated]           ...           8 months ago
  • 0.0.5 [deprecated]           ...           8 months ago
  • 0.0.4 [deprecated]           ...           8 months ago
  • 0.0.3 [deprecated]           ...           8 months ago
  • 0.0.2 [deprecated]           ...           8 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 5
Last Day 0
Last Week 0
Last Month 5
Dependencies (1)
Dev Dependencies (7)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |