@adamhancock/portx
v2.2.1
Published
Port testing CLI tool - TypeScript version
Maintainers
Readme
PortX - TypeScript Edition
A modern TypeScript port testing CLI tool for checking network connectivity and HTTP status.
Installation
npm install -g @adamhancock/portxUsage
Test a single host
portx -h google.com:443Test with HTTP status check
portx -h google.com:443 -s
portx -h google.com:443 -s httpsTest from a file
portx -f hosts.jsonTest with environment templating
portx -f template-hosts.json -e dev,staging,prodConfiguration Files
Simple hosts file (hosts.json)
[
{
"name": "Google",
"host": "google.com",
"port": 443
},
{
"name": "GitHub",
"host": "github.com",
"port": 443
}
]Template hosts file with environment variables
[
{
"name": "API Server",
"host": "{{env}}.api.example.com",
"port": 443
}
]Options
-h, --host <string>: Test a single host in formathost:port-f, --file <string>: Load hosts from a JSON file-e, --env <string>: Environment templating (comma-separated environments)-s, --status [type]: Check HTTP status code (optional: specify 'http' or 'https')-v, --version: Show version number
Features
- ✅ Port connectivity testing
- ✅ DNS resolution
- ✅ HTTP/HTTPS status checking
- ✅ Environment templating with Handlebars
- ✅ Colorized output
- ✅ TypeScript with full type safety
- ✅ Modern async/await patterns
Examples
Check if services are accessible:
portx -h api.example.com:443 -s httpsTest multiple environments:
portx -f hosts.json -e dev,staging,prodLicense
ISC
