3.1.2 • Published 12 months ago

get-port-please v3.1.2

Weekly downloads
273,539
License
MIT
Repository
github
Last release
12 months ago

🔌 get-port-please

Get an available TCP port to listen

npm version npm downloads License JSDocs

Usage

Install package:

npm i get-port-please
// ESM
import {
  getPort,
  checkPort,
  getRandomPort,
  waitForPort,
} from "get-port-please";

// CommonJS
const {
  getPort,
  checkPort,
  getRandomPort,
  waitForPort,
} = require("get-port-please");
getPort(options?: GetPortOptions): Promise<number>
checkPort(port: number, host?: string): Promise<number | false>
waitForPort(port: number, options): Promise<number | false>

Try sequence is: port > ports > random

Options

interface GetPortOptions {
  name?: string;

  random?: boolean;
  port?: number;
  portRange?: [fromInclusive: number, toInclusive: number];
  ports?: number[];
  host?: string;

  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

Extended ports to check.

portRange

Extended port range to check.

The range's start and end are inclusive, i.e. it is [start, end] in the mathematical notion. Reversed port ranges are not supported. If start > end, then an empty range will be returned.

alternativePortRange

Alternative port range to check as fallback when none of the ports are available.

The range's start and end are inclusive, i.e. it is [start, end] in the mathematical notion. Reversed port ranges are not supported. If start > end, then an empty range will be returned.

The default range is [3000, 3100] (only when port is unspecified).

host

The host to check. Default is process.env.HOST otherwise all available hosts will be checked.

License

MIT

@infinitebrahmanuniverse/nolb-get-pscreeps-grafana@everything-registry/sub-chunk-1752tailwindcss-webpack-pluginvxrnshowgalleryscreeps-grafana-go_carbonrsbuild-plugin-console-debugrsbuild-plugin-react-inspectorrsbuild-plugin-svelte-inspectorrsbuild-plugin-vue-inspectorsedanbosoktiddlywiki-plugin-devvite-plugin-lowcode-material-vuevoidonevite-test-utils-edgevite-test-utilsvitronloading-animatedlisthenmajlost-pixelmariposemangudinlagirajinmaster-imagesoro-functionspileuleuyanteapostgres-node-containernitro-sandboxpatepangdeuinuxthubnuxtpaginationsnuxt-module-chrome-devtoolsnuxt-module-eslint-confignuxt-vitestrdf-serveregex-doctorrefinejs-repotehmusimhujanslidev-cli-magiclidesslidev-cli-magicslidessimmtypescript-basics@arque/examples@animespace/animegarden@atinux/nuxthub@akkuma/vinxi@akrc/fnpm@cardano-sdk/e2e@cardano-sdk/util-dev@chrome-devtools-embedded/nuxt@chiballc/armon@0x1461a0/sd-plugin-scripts@aabelmann/ui-layer@danizean/cyberzonezona-xvinxiunplugin-todosunplugin-turbo-consoleunplugin-dingtalkvease@dxos/functions@dword-design/nuxt-vite-builder@dtwo/loading-screen@dtwo/wite-builder@dtwo/wite-builder-edge@hankts/shopify-cli-kit@formkit/cli@hwy-js/build@eslint/config-inspector@liuyang0826/dev-kits@nattyjs/common@next-devtools/core@fakeyanss/redocly-cli@joshmossas/listhen@kolibrijs/cli@kolibry/cli@jeswr/css-auth-utils@hotfusion/http@hotfusion/proxy@hwy-js/dev@moquerie/core@oeyoews/tiddlywiki-plugin-dev@redocly/cli@storybook-vue/nuxt-storybook@playlistduong/s-deploy@nuxt/bridge@nuxt/bridge-edge@nuxt/vite-builder-edge@nuxt/vite-builder-nightly@nuxt/vite-builder@nuxt/sigma@nuxt/test-utils@nuxt/test-utils-edge@nuxt/test-utils-nightly@nuxt/devtools@nuxt/loading-screen@nuxt/devtools-edge@nuxt/eslint@nuxtjs/storybook
3.1.2

12 months ago

3.0.3

1 year ago

3.1.1

1 year ago

3.1.0

1 year ago

3.0.2

1 year ago

3.0.1

2 years ago

2.6.1

2 years ago

2.6.0

2 years ago

2.5.0

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.4.3

3 years ago

2.4.2

3 years ago

2.3.0

3 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.1.0

4 years ago

1.0.0

5 years ago

0.0.6

5 years ago

2.0.2

5 years ago