1.0.32 • Published 2 years ago

portfinder v1.0.32

Weekly downloads
13,507,363
License
MIT
Repository
github
Last release
2 years ago

node-portfinder CI

Installation

  $ npm install portfinder

Usage

The portfinder module has a simple interface:

  var portfinder = require('portfinder');

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

Or with promise (if Promises are supported) :

  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.
        //
    });

If portfinder.getPortPromise() is called on a Node version without Promise (<4), it will throw an Error unless Bluebird or any Promise pollyfill is used.

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@modern-js/plugin-ssg@obstinate/react-script@obstinate/vue-script@quiteer/electronupalioss-plugindecentralandcomponennentt@taqueria/plugin-flextesa@atomist/automation-client@atomist/sdm-local@knapsack/app@redwoodjs/cli@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-docsify
1.0.29

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.28

4 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.7-beta.0

8 years ago

1.0.7-0

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.4.0

9 years ago

0.3.0

9 years ago

0.2.1

12 years ago

0.2.0

13 years ago

0.1.0

13 years ago