ya-ps
v0.0.3
Published
Yet Another ps implementation
Downloads
3
Readme
node-ya-ps
Yet another ps implementation.
Installation
Install with npm
npm install ya-ps
Install from Github with npm
npm install git+https://github.com/sgen/node-ya-ps.git
Clone from Github directly
git clone https://github.com/sgen/node-ya-ps
Usage
Lookup running processes
var ps = require('ya-ps');
ps.lookup(function(err, results) {
if (err) {
console.error(err);
return;
}
results.forEach(function(result) {
console.log('user : ', result.user);
console.log('pid : ', result.pid);
console.log('ppid : ', result.ppid);
console.log('cpu time : ', result.time);
console.log('command : ', result.command);
console.log('arguments : ', result.args);
});
});
Lookup a process by pid
var ps = require('ya-ps');
var pid = 123;
ps.lookup(pid, function(err, results) {
if (err) {
console.error(err);
return;
}
var result = results[0];
console.log('user : ', result.user);
console.log('pid : ', result.pid);
console.log('ppid : ', result.ppid);
console.log('cpu time : ', result.time);
console.log('command : ', result.command);
console.log('arguments : ', result.args);
});
Kill a specific process
var ps = require('ya-ps');
var pid = 123;
ps.kill(pid, function(err) {
if (err) {
console.error(err);
}
});