📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

porty

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

porty

Porty quickly and easily find available ports.

3.1.1
latest
Source
npm
Version published
Weekly downloads
1.2K
-18.25%
Maintainers
1
Weekly downloads
 
Created
Source

Porty

Porty quickly and easily find available ports.

Install

npm i porty --save

Example

const port = await Porty.find({
	min: 8080,
	max: 8090,
	avoids: [8081, 8080, 8082, 8083, 8084]
});

console.log(port); // 8085

Porty.test(port)

Tests if a port is in use. Returns a boolean.

  • port: Number port to test

Porty.find([options,] [min, max, avoids])

Arguments can be a single object or one/two number arguments. All arguments are optional. Return value is a open port number >= min <= max.

  • options: Object
    • min: Number port number to start (default: 8,000)
    • max: Number port number to end (default: 10,000)
    • avoids: Array array of port numbers to avoid
  • min: Number
  • max: Number
  • avoids: Array

Porty.get

Alias for Porty.find

Authors

AlexanderElias

License

Why You Should Choose MPL-2.0 This project is licensed under the MPL-2.0 License

Keywords

port

FAQs

Package last updated on 12 Nov 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