Cross-platform api of finding pid under specified conditions.
$ npm i find-pid
Note: For some linux distributions, netstat
is not available util
you install net-tools
, run sudo apt-get install net-tools
.
const findByPort = require('find-pid').byPort;
findByPort(7777, (err, pid) => {
console.log(pid);
});
- byPort(port, callback)
Find pid by port.
Now the only api is byPort
, other features is not planned until i
really need it. But i am very happy to accept a PR :)
MIT