@kszongic/port-finder
v1.0.0
Published
Find available ports on your machine. Zero dependencies.
Downloads
19
Maintainers
Readme
@kszongic/port-finder
Find available ports on your machine. Zero dependencies. Fast.
Install
npm i -g @kszongic/port-finderUsage
# Find one free port starting at 3000
port-finder
# Start from port 8000
port-finder -p 8000
# Find 5 free ports
port-finder -c 5
# Check a range
port-finder --range 4000-5000 -c 3
# Bind to specific host
port-finder -h 127.0.0.1 -p 5000Programmatic
// It's a CLI tool, but you can also use the logic:
const { execSync } = require('child_process');
const port = execSync('npx @kszongic/port-finder').toString().trim();Options
| Flag | Description | Default |
|------|-------------|---------|
| -p, --port | Starting port | 3000 |
| -c, --count | Number of ports to find | 1 |
| -h, --host | Host to bind | 0.0.0.0 |
| --range | Port range (e.g. 8000-9000) | — |
License
MIT © 2026 kszongic
