Is there a way to get a process by it's process id in node.js? You have the default process
object in node, something similar to that object, but i can get an existing process on the system. Something like:var otherProcess = getProcessById(12345)
check find-process library maybe help you
you can find process by pid
:
const find = require('find-process');
find('pid', 12345)
.then(function (list) {
console.log(list);
}, function (err) {
console.log(err.stack || err);
})
EDIT:
for communication between process
you can use ipc
(inter process communication)
check node-ipc npm package