portproc-core
v0.0.1
Published
module for finding what port a process is using; or what process is using a port
Downloads
2
Maintainers
Readme
PortProc
A utility to:
- get the ID of the process currently using a given port
- get the port currently in use by a given process ID
Installation
npm install --save portproc-core
Usage
const { portToProc, procToPort } = require("portproc");
// Get the PID of the process using port 3000
portToProc(3000)
.then(proc => console.log("process id: " + proc);
// Get the port that process '54321' is currently using
procToPort(54321)
.then(port => console.log("port: " + port));
Both utilities take in an integer number, and return a promise.
If you provide a port or process ID and no match can be found, the promise will reject.