Pular para o conteúdo principal
Versão: v2.x.x

Buscando PIDs

Retorna os IDs dos processos usados pelas portas e intervalos de portas especificados.

getPIDs

Retorna todos os IDs dos processos usados pelas portas especificadas.

getPIDs(porta: number | number[])

  • Requer lsof para Unix e netstat para Windows.
import { getPIDs } from 'poku';

await getPIDs(4000);
await getPIDs([4000, 4001]);

getPIDs.range

Retorna todos os IDs dos processos usados pelo intervalo de portas especificado.

getPIDs.range(iniciaEm: number, terminaEm: number)

  • Requer lsof para Unix e netstat para Windows.
import { getPIDs } from 'poku';

await getPIDs.range(4000, 4100);

dica

Se o seu ambiente não incluir o lsof por padrão:

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