{"name":"pidtree","version":"1.0.0","description":"Cross platform children list of a PID","license":"MIT","homepage":"http://github.com/simonepri/pidtree#readme","repository":{"type":"git","url":"git+https://github.com/simonepri/pidtree.git"},"bugs":{"url":"https://github.com/simonepri/pidtree/issues","email":"simonepri@outlook.com"},"author":{"name":"Simone Primarosa","email":"simonepri@outlook.com","url":"https://github.com/simonepri"},"contributors":[{"name":"Simone Primarosa","email":"simonepri@outlook.com","url":"https://github.com/simonepri"}],"keywords":["ps-tree","ps","tree","ppid","pid","pidtree","pgrep","list","all","system","process","processes"],"type":"module","exports":{".":{"types":"./index.d.ts","default":"./index.js"}},"main":"index.js","types":"index.d.ts","bin":{"pidtree":"bin/pidtree.js"},"engines":{"node":">=18"},"scripts":{"start":"node ./bin/pidtree.js","lint":"xo","test":"c8 ava -m \"!*benchmark*\"","types":"tsd","bench":"ava -m \"*benchmark*\""},"devDependencies":{"ava":"^6.4.1","c8":"^10.1.3","time-span":"^5.1.0","tree-kill":"^1.2.2","tsd":"^0.33.0","xo":"^2.0.2"},"c8":{"reporter":["lcov","text"]},"xo":{"prettier":true,"space":true,"rules":{"n/prefer-global/process":"off","n/prefer-global/buffer":"off","require-unicode-regexp":"off","unicorn/prefer-top-level-await":"off"}},"gitHead":"01f2ba126afdfd4e323e56362e5fc9d8da7d8e02","_id":"pidtree@1.0.0","_nodeVersion":"24.16.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-avfAvjB9Dd0wdj3rjJX//yS+G79OO0KrS5pJHFJENjYGX6N4SMgEDBBI/yFy0lloOYSaC6XQxzpOAMPfSYFV/Q==","shasum":"55a9b149ba64519a8b46781165a122a34f4a6d31","tarball":"http://registry-npm.ywwl.com/pidtree/download/pidtree-1.0.0.tgz","fileCount":13,"unpackedSize":25261,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/pidtree@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCWSa1CYJFrcHddUxQCzayLuTx5EcoL1+65mnOej7DC9AIhAOSqlMHKufFjhqxh6Saf+7N4ExDnWVGvEir8Uww4X2WJ"}],"size":8129,"noattachment":false,"key":"/pidtree/-/pidtree-1.0.0.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:11129aee-94d1-42be-bf83-0821e88b72b3"}},"directories":{},"maintainers":[{"name":"simonepri","email":"simone.primarosa@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pidtree_1.0.0_1780918954864_0.18975876824282167"},"_hasShrinkwrap":false,"readme":"<h1 align=\"center\">\n  <b>pidtree</b>\n</h1>\n<p align=\"center\">\n  <!-- Version - npm -->\n  <a href=\"https://www.npmjs.com/package/pidtree\">\n    <img src=\"https://img.shields.io/npm/v/pidtree.svg\" alt=\"Latest version on npm\" />\n  </a>\n  <!-- Downloads - npm -->\n  <a href=\"https://npm-stat.com/charts.html?package=pidtree\">\n    <img src=\"https://img.shields.io/npm/dt/pidtree.svg\" alt=\"Downloads on npm\" />\n  </a>\n  <!-- License - MIT -->\n  <a href=\"https://github.com/simonepri/pidtree/tree/master/license\">\n    <img src=\"https://img.shields.io/github/license/simonepri/pidtree.svg\" alt=\"Project license\" />\n  </a>\n\n  <br/>\n\n  <!-- Lint -->\n  <a href=\"https://github.com/simonepri/pidtree/actions?query=workflow:lint+branch:master\">\n    <img src=\"https://github.com/simonepri/pidtree/workflows/lint/badge.svg?branch=master\" alt=\"Lint status\" />\n  </a>\n  <!-- Test - macOS -->\n  <a href=\"https://github.com/simonepri/pidtree/actions?query=workflow:test-macos+branch:master\">\n    <img src=\"https://github.com/simonepri/pidtree/workflows/test-macos/badge.svg?branch=master\" alt=\"Test macOS status\" />\n  </a>\n  <!-- Test - Ubuntu -->\n  <a href=\"https://github.com/simonepri/pidtree/actions?query=workflow:test-ubuntu+branch:master\">\n    <img src=\"https://github.com/simonepri/pidtree/workflows/test-ubuntu/badge.svg?branch=master\" alt=\"Test Ubuntu status\" />\n  </a>\n  <!-- Test - Windows -->\n  <a href=\"https://github.com/simonepri/pidtree/actions?query=workflow:test-windows+branch:master\">\n    <img src=\"https://github.com/simonepri/pidtree/workflows/test-windows/badge.svg?branch=master\" alt=\"Test Windows status\" />\n  </a>\n  <!-- Coverage - Codecov -->\n  <a href=\"https://codecov.io/gh/simonepri/pidtree\">\n    <img src=\"https://img.shields.io/codecov/c/github/simonepri/pidtree/master.svg\" alt=\"Codecov Coverage report\" />\n  </a>\n  <!-- DM - Snyk -->\n  <a href=\"https://snyk.io/test/github/simonepri/pidtree?targetFile=package.json\">\n    <img src=\"https://snyk.io/test/github/simonepri/pidtree/badge.svg?targetFile=package.json\" alt=\"Known Vulnerabilities\" />\n  </a>\n\n  <br/>\n\n  <!-- Code Style - XO-Prettier -->\n  <a href=\"https://github.com/xojs/xo\">\n    <img src=\"https://img.shields.io/badge/code_style-XO+Prettier-5ed9c7.svg\" alt=\"XO Code Style used\" />\n  </a>\n  <!-- Test Runner - AVA -->\n  <a href=\"https://github.com/avajs/ava\">\n    <img src=\"https://img.shields.io/badge/test_runner-AVA-fb3170.svg\" alt=\"AVA Test Runner used\" />\n  </a>\n  <!-- Test Coverage - c8 -->\n  <a href=\"https://github.com/bcoe/c8\">\n    <img src=\"https://img.shields.io/badge/test_coverage-c8-fec606.svg\" alt=\"c8 Test Coverage used\" />\n  </a>\n  <!-- Init - ni -->\n  <a href=\"https://github.com/simonepri/ni\">\n    <img src=\"https://img.shields.io/badge/initialized_with-ni-e74c3c.svg\" alt=\"NI Scaffolding System used\" />\n  </a>\n  <!-- Release - release-please -->\n  <a href=\"https://github.com/googleapis/release-please\">\n    <img src=\"https://img.shields.io/badge/released_with-release--please-6c8784.svg\" alt=\"release-please Release System used\" />\n  </a>\n</p>\n<p align=\"center\">\n  🚸 Cross platform children list of a PID.\n\n  <br/>\n\n  <sub>\n    Coded with ❤️ by <a href=\"#authors\">Simone Primarosa</a>.\n  </sub>\n</p>\n\n## Synopsis\n\nThis package is really similar to [ps-tree][gh:ps-tree] but is faster, safer and\nprovides sub-children results.  \nFurthermore ps-tree is [unmaintained][gh:ps-tree-um].\n\nUuh, and a fancy [CLI](#cli) is also available!\n\n## Install\n\n```bash\nnpm install pidtree\n```\n\n> **Requirements:** pidtree is an [ESM-only][gh:esm] package and requires\n> **Node.js >= 18**. If you need CommonJS (`require`) or support for older\n> Node.js versions, stay on [`pidtree@0.6`](https://www.npmjs.com/package/pidtree/v/0.6.1).\n\n## Usage\n\n```js\nimport pidtree from 'pidtree'\n// The named import works too: import {pidtree} from 'pidtree'\n\n// Get children of the current process (a promise is returned)\nconst pids = await pidtree(process.pid)\nconsole.log(pids)\n// => []\n\n// Include the given pid in the result array\nconsole.log(await pidtree(process.pid, {root: true}))\n// => [727]\n\n// Get all the processes of the System (-1 is a special value of this package)\nconsole.log(await pidtree(-1))\n// => [530, 42, ..., 41241]\n\n// Include the PPID in the results\nconsole.log(await pidtree(1, {advanced: true}))\n// => [{ppid: 1, pid: 530}, {ppid: 1, pid: 42}, ..., {ppid: 1, pid: 41241}]\n\n// A Node-style callback is also supported instead of a promise\npidtree(1, function (err, pids) {\n  console.log(pids)\n  // => [141, 42, ..., 15242]\n})\n```\n\n## Compatibility\n\n| Linux | FreeBSD | NetBSD | SunOS | macOS | Win | AIX |\n| --- | --- | --- | --- | --- | --- | --- |\n| ✅ | ❓ | ❓ | ❓ | ✅ | ✅ | ❓ |\n\n✅ = Working\n❓ = Not tested but should work\n\nPlease if your platform is not supported [file an issue][new issue].\n\n## CLI\n\n<img src=\"https://github.com/simonepri/pidtree/raw/master/media/cli.gif\" alt=\"pidtree cli\" width=\"300\" align=\"right\"/>\nShow a tree of the processes inside your system inside your terminal.\n\n```bash\nnpx pidtree $PPID\n```\nJust replace `$PPID` with one of the pids inside your system.\n\nOr don't pass anything if you want all the pids inside your system.\n\n```bash\nnpx pidtree\n```\n\nTo display the output as a list, similar to the one produced from `pgrep -P $PID`,\npass the `--list` flag.\n\n```bash\nnpx pidtree --list\n```\n\n## API\n\n<a name=\"pidtree\"></a>\n\n## pidtree(pid, [options], [callback]) ⇒ <code>[Promise.&lt;Array.&lt;Object&gt;&gt;]</code>\nGet the list of children pids of the given pid.\n\n**Kind**: global function  \n**Returns**: <code>Promise.&lt;Array.&lt;Object&gt;&gt;</code> - Only when the callback is not provided.  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| pid | <code>Number</code> \\| <code>String</code> |  | A pid. If -1 will return all the pids. |\n| [options] | <code>Object</code> |  | Optional options object. |\n| [options.root] | <code>Boolean</code> | <code>false</code> | Include the provided pid in the list. Ignored if -1 is passed as pid. |\n| [callback] | <code>function</code> |  | Called when the list is ready. If not provided a promise is returned instead. |\n\n## Related\n\n- [pidusage][gh:pidusage] -\nCross-platform process cpu % and memory usage of a PID\n\n## Authors\n\n- **Simone Primarosa** - [simonepri][github:simonepri]\n\nSee also the list of [contributors][contributors] who participated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [license][license] file for details.\n\n<!-- Links -->\n[new issue]: https://github.com/simonepri/pidtree/issues/new\n[license]: https://github.com/simonepri/pidtree/tree/master/license\n[contributors]: https://github.com/simonepri/pidtree/contributors\n\n[github:simonepri]: https://github.com/simonepri\n\n[gh:esm]: https://nodejs.org/api/esm.html\n[gh:pidusage]: https://github.com/soyuka/pidusage\n[gh:ps-tree]: https://github.com/indexzero/ps-tree\n[gh:ps-tree-um]: https://github.com/indexzero/ps-tree/issues/30\n","publish_time":1780918955005,"_cnpm_publish_time":1780918955005,"dist-tags":{"latest":"1.0.0"}}