node-ps-promise
v1.0.0
Published
ps command wrapper. Promise implementation on top of github.com/neekey/ps
Downloads
1,700
Readme
node-ps
node-ps is ps tool wrapper implementing promises.
node-ps wraps neekey's ps-node library
Installation
Install with npm.
npm install node-ps
or Clone from github
git clone http://github.com/sgen/node-ps
Usage
For full usage see neekey's node-ps library. lookup
and kill
function identically with the exception of the replacement of the callbacks with promises;
Lookup a process
var ps = require('node-ps');
ps.lookup({
pid: 123
}).then(function(results) {
for (i = 0; i < results.length; i++) {
console.log('Result %s: %s', i, results[i])
}
}).catch(function(err) {
console.error(err);
});
Kill a process
var ps = require('node-ps');
ps.kill(123).then(function(pid) {
console.log(pid);
}).catch(function(err) {
console.error(err);
});