kill-port-process

一个 Node.js 工具,支持通过编程方式或 CLI 终止指定端口上的长时间运行进程。

Introductionkill-port-process , 以编程方式或使用CLI终止端口上的长时间运行进程## Usage### Programmaticjavascriptconst killPortProcess = require('kill-port-process');const PORT = 1234; // long-running process running on this, e.g. a web-server.await killPortProcess(PORT); // takes a number or a number[]### CLIInstall the module globally: npm install kill-port-process -g.You can use the CLI calling it with kill-port <port>.It takes a single port or a list of ports separated by a space. Valid flags are -p and --port but are both optional.bash$ kill-port 1234# or multiple ports$ kill-port 1234 2345# or$ kill-port -p 1234# or$ kill-port --port 1234