1.0.0 • Published 5 months ago

is-port-available2 v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

is-port-available2

A command-line tool to check if a port is available or get an available port.

Installation

npm install -g is-port-available2

Usage

Check if a port is available:

is-port-available2 -p 3000

Get an available port starting from a specific port:

is-port-available2 -p 3000 -g

API

You can also use this package programmatically:

import { isPortAvailable, getAvailablePort } from 'is-port-available2';

// Check if a port is available
const available = await isPortAvailable(3000);
console.log(available); // true or false

// Get an available port
const port = await getAvailablePort(3000);
console.log(port); // 3000 or next available port

Options

  • -p, --port <number>: Port to check (required)
  • -g, --get: Get an available port
  • -V, --version: Output the version number
  • -h, --help: Display help for command

License

MIT

1.0.0

5 months ago