is-port-available2
v1.0.0
Published
Check if a port is available or get an available port
Readme
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-available2Usage
Check if a port is available:
is-port-available2 -p 3000Get an available port starting from a specific port:
is-port-available2 -p 3000 -gAPI
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 portOptions
-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
