1.0.4 • Published 7 years ago

porti v1.0.4

Weekly downloads
23
License
MIT
Repository
github
Last release
7 years ago

porti

Build Status NPM version

Node.js utility for obtaining random TCP ports

Installation

npm install porti --save

Usage

const porti = require('porti');

// Finding an unused port in a range of ports. If a range is not specified,
// Porti starts at port 1024 and stops when it has found an unused port.
// None of the properties in the first options argument are required.
porti.getUnusedPort({
  min: 2000,          // lower bound of random port range to select from
  max: 5000,          // upper bound of random port range to select from
}).then((port) => {
  ...
}).catch((err) => {
  ...
})

Synchronous API:

// Finding an unused port in a range of ports. If a range is not specified,
// Porti starts at port 1024 and stops when it has found an unused port.
// None of the properties in the first options argument are required.
const port = porti.getUnusedPortSync({
  min: 2000,          // lower bound of random port range to select from
  max: 5000,          // upper bound of random port range to select from
})
1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

8 years ago

0.0.6

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago