Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including porty with all npm packages installed. Try it out:

var porty = require("porty")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

porty v3.1.1

Porty quickly and easily find available ports.


Porty quickly and easily find available ports.


npm i porty --save


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

console.log(port); // 8085


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


Alias for Porty.find




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

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free