first commit

This commit is contained in:
Artem Anufrij
2026-10-07 18:56:27 +02:00
commit 2a8a60b725
7768 changed files with 1550851 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
import {promisify} from 'node:util';
import {pidtreeCallback} from './lib/pidtree.js';
const pidtreeAsync = promisify(pidtreeCallback);
/**
* Get the list of children pids of the given pid.
* @public
* @param {number|string} pid A PID. If -1 will return all the pids.
* @param {object} [options] Optional options object.
* @param {boolean} [options.root=false] Include the provided PID in the list.
* @param {boolean} [options.advanced=false] Returns a list of objects in the
* format {ppid: X, pid: Y}.
* @param {Function} [callback] Called when the list is ready. If not provided a
* promise is returned instead.
* @returns {Promise<object[]>|void} Only when the callback is not provided.
*/
function pidtree(pid, options, callback) {
if (typeof options === 'function') {
callback = options;
options = undefined;
}
if (typeof callback === 'function') {
pidtreeCallback(pid, options, callback);
return;
}
return pidtreeAsync(pid, options);
}
export default pidtree;
export {pidtree};