Seaching PIDs
Returns processes IDs used by the specified ports and port ranges.
getPIDsβ
Returns all processes IDs used by the specified ports.
getPIDs(port: number | number[])
- Requires
lsof
for Unix andnetstat
for Windows.
import { getPIDs } from 'poku';
await getPIDs(4000);
await getPIDs([4000, 4001]);
getPIDs.rangeβ
Returns all processes IDs used by the specified port range.
getPIDs.range(startsAt: number, endsAt: number)
- Requires
lsof
for Unix andnetstat
for Windows.
import { getPIDs } from 'poku';
await getPIDs.range(4000, 4100);
tip
If your environment doesn't include lsof
by default:
macOS (Homebrew)
brew install lsof
Debian, Ubuntu, etc.
sudo apt-get install lsof
Arch Linux, etc.
sudo pacman -S lsof
Alpine Linux, etc.
apk add lsof