killit
v1.1.1
Published
Simple, fast port killer with zero dependencies
Maintainers
Readme
killit
Simple, fast port killer with zero dependencies
Kill processes running on specified ports. Works on macOS, Linux, and Windows.
Features
- ✨ Zero dependencies - Only uses Node.js built-in modules
- 🚀 Fast & Simple - Clean TypeScript code
- 🔧 Cross-platform - Works on macOS, Linux, and Windows
- 📦 Tiny - Minimal footprint
- 🎯 Multiple ports - Kill multiple ports at once
- 🔌 TCP & UDP - Support for both protocols
Installation
Global Installation
npm install -g killitLocal Installation
npm install killitUse without installation (npx)
npx killit 3000CLI Usage
# Kill single port
killit 3000
# Kill multiple ports
killit 3000 8080 5000
# Using --port flag
killit --port 3000
killit --port 3000,8080,5000
# Kill UDP process
killit 9000 --method udp
# Verbose output
killit 3000 --verboseOptions
-p, --port <port>- Port number(s) to kill (comma-separated)-m, --method <protocol>- Protocol:tcporudp(default:tcp)-v, --verbose- Show detailed output-h, --help- Show help message
Programmatic Usage
import { killPort, killPorts } from 'killit';
// Kill single port
await killPort(3000);
// Kill with options
await killPort(3000, { protocol: 'tcp', verbose: true });
// Kill multiple ports
await killPorts([3000, 8080, 5000]);
// Kill multiple ports with options
await killPorts([3000, 8080], { protocol: 'udp', verbose: true });API
killPort(port, options?)
Kill process on a single port.
Parameters:
port(number | string) - Port number (1-65535)options(optional)protocol('tcp' | 'udp') - Default: 'tcp'verbose(boolean) - Default: false
Returns: Promise
Throws: Error if port is invalid or no process found
killPorts(ports, options?)
Kill processes on multiple ports.
Parameters:
ports(Array<number | string>) - Array of port numbersoptions(optional) - Same as killPort
Returns: Promise
Throws: Error if any port fails to kill
Development
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run devWhy killit?
Compared to other port-killing tools:
- Zero dependencies - No external packages needed
- Simpler code - Easy to understand and modify
- TypeScript - Full type safety
- Modern - Uses async/await, ES modules
- Tiny - Minimal package size
License
MIT
