New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

porti

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

porti

Node.js utility for system ports

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

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
})

Keywords

port

FAQs

Package last updated on 05 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts