1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
declare namespace psList {
interface Options {
/**
Include other users' processes as well as your own.
On Windows this has no effect and will always be the users' own processes.
@default true
*/
readonly all?: boolean;
}
interface ProcessDescriptor {
readonly pid: number;
readonly name: string;
readonly ppid: number;
/**
Not supported on Windows.
*/
readonly cmd?: string;
/**
Not supported on Windows.
*/
readonly cpu?: number;
/**
Not supported on Windows.
*/
readonly memory?: number;
/**
Not supported on Windows.
*/
readonly uid?: number;
}
}
declare const psList: {
/**
Get running processes.
@returns List of running processes.
@example
```
import psList = require('ps-list');
(async () => {
console.log(await psList());
//=> [{pid: 3213, name: 'node', cmd: 'node test.js', ppid: 1, uid: 501, cpu: 0.1, memory: 1.5}, …]
})();
```
*/
(options?: psList.Options): Promise<psList.ProcessDescriptor[]>;
// TODO: remove this in the next major version, refactor the whole definition to:
// declare function psList(options?: psList.Options): Promise<psList.ProcessDescriptor[]>;
// export = psList;
default: typeof psList;
};
export = psList;
|