1.0.35 • Published 6 months ago

portfinder v1.0.35

Weekly downloads
13,507,363
License
MIT
Repository
github
Last release
6 months ago

node-portfinder

CI

Installation

You can install portfinder using a package manager like npm, yarn, or bun:

npm install portfinder

Usage

The portfinder module has a simple interface:

const portfinder = require('portfinder');

portfinder.getPort(function (err, port) {
  //
  // `port` is guaranteed to be a free port
  // in this scope.
  //
});

Or using promises:

const portfinder = require('portfinder');

portfinder.getPortPromise()
  .then((port) => {
    //
    // `port` is guaranteed to be a free port
    // in this scope.
    //
  })
  .catch((err) => {
    //
    // Could not get a free port, `err` contains the reason.
    //
  });

Ports search scope

By default portfinder will start searching from 8000 and scan until maximum port number (65535) is reached.

You can change this globally by setting:

portfinder.setBasePort(3000);    // default: 8000
portfinder.setHighestPort(3333); // default: 65535

or by passing optional options object on each invocation:

portfinder.getPort({
  port: 3000,    // minimum port
  stopPort: 3333 // maximum port
}, callback);

Run Tests

npm test

Author: Charlie Robbins

Author/Maintainer: Erik Trom

License: MIT/X11

http-servervscode-mysql-client2datadaddy@bugsounet/cvlc@obstinate/react-script@obstinate/vue-script@quiteer/electronupalioss-plugindecentralandcomponennentt@atomist/automation-client@atomist/sdm-local@ishopee/cli-servicevuedragdropuploadimagesmege@jerryhorak/docusaurus-corepivtrs-vue-cli@bonobolabs/firebase-tools-deploy-parallelismwebpc-plugreact-static-juroshdoki-scriptstart-kit-builder-flexible@autofleet/node-commonmylicensebuilder-webpack4-vuehttp-server-aconitebritive-cli-test1accellion_orchestration_clientamaca@kibalabs/react-staticlexasclipg-cli-servicefund-unitizertoken-proxyfx-webpack-ttkvue-cli-evwtbagua.js@pixelfox/mock-mongoosezeno-test-clizeno-test-pkgwebpack-dev-server-http2temp2-test-scriptsabrown-sample-plugin@kzx/citic-cli-servicevitepress-dgkill-process-occupying-portjoshtestingbuerli-nodebb-chat@willhayes/want-clivue-cli-plugin-alphasqaure-cordova-testvue-cli-plugin-alphasquare-cordova-testvue-cli-plugin-as-cordova@frxf/frxfcgdemouikbc-ui-cli-v2@dqyfp/dl-cli-spa@texttree/demo-bsa-reference-rcl@startdt/cli-service@startdt/cli-uimagic-home-scaffoldbamboosssstestesdfasdfsadfsdafhy-element-ui@lartplus/cli-service@startdt/next-work@startdt/next-servicecustom-angular-clivitepress-for-component-customphat-scriptsmeitq-elementhzero-cli-uibbc_clifragrans-clifrag-cliegg-react-builderbuild-webpack-packagehao-excalibur@sbase-theme-cli-demo/cli-service@sbase-theme-test/cli-servicesparrow-bird-codexgbui@l1nyanm1ng/react-picture-viewer@erikpham/cli-service@ez-fe/ez@fect-ui/fect-cli@cluth/react-buildercthpb-plugin-social@you54f/serverless-offlinezoos-mp-images@gentean/vue-cli-serviceprerender-spa-plugin-custompowerhostvscode-azureappservice-lavlib-docsifyteasim-mockersderpatronlevibestliblevibestlib2
1.0.33

6 months ago

1.0.35

6 months ago

1.0.34

6 months ago

1.0.29

3 years ago

1.0.32

3 years ago

1.0.31

3 years ago

1.0.30

3 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

7 years ago

1.0.19

7 years ago

1.0.18

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.13

9 years ago

1.0.12

9 years ago

1.0.11

9 years ago

1.0.10

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.7-beta.0

9 years ago

1.0.7-0

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.4.0

11 years ago

0.3.0

11 years ago

0.2.1

14 years ago

0.2.0

14 years ago

0.1.0

14 years ago