Process status in Node.js as you've always wanted
Promise oriented and lightweight Javascript utility for getting info about the processes runing in your machine. It is designed to give you a friendly api for filter within all of them.
Install
$ npm install psaux --save
Usage
Display the user
, pid
, cpu
and mem
of all the running processes:
const psaux = ; ;
Find a concrete process using his pid
;
Display inefficient processes started from the root
user.
;
Search for a process containing the passed string (very useful if you don't know the pid)
;
Filters
You can filter by every property of the returned objects using the query method. Also you can create complex filters if needed:
list;
>
Greater than:>5
<
Lower than:<5
~
Contains:~Chrome
Properties
The properties you can access are basically the same listed in the ps
command:
- user: user owning the process
- pid: process ID
- cpu: It is the CPU time used divided by the time the process has been running.
- mem: ratio of the process’s resident set size to the physical memory on the machine
- vsz: virtual memory usage of entire process (in KiB)
- rss: resident set size, the non-swapped physical memory that a task has used (in KiB)
- tt: controlling tty (terminal)
- stat: multi-character process state
- started: starting time or date of the process
- time: cumulative CPU time
- command: command with all its arguments
Supported platforms
The module currently supports Mac OS, Linux and Windows.