• Stars
    star
    124
  • Rank 279,214 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🚸 Cross platform children list of a PID.

pidtree

Latest version on npm Downloads on npm Project license
Lint status Test macOS status Test Ubuntu status Test Windows status Codecov Coverage report Known Vulnerabilities
XO Code Style used AVA Test Runner used Istanbul Test Coverage used NI Scaffolding System used NP Release System used

🚸 Cross platform children list of a PID.
Coded with ❀️ by Simone Primarosa.

Synopsis

This package is really similar to ps-tree but is faster, safer and provides sub-children results.
Furthermore ps-tree is unmaintained.

Uuh, and a fancy CLI is also available!

Usage

var pidtree = require('pidtree')

// Get childs of current process
pidtree(process.pid, function (err, pids) {
  console.log(pids)
  // => []
})

// Include the given pid in the result array
pidtree(process.pid, {root: true}, function (err, pids) {
  console.log(pids)
  // => [727]
})

// Get all the processes of the System (-1 is a special value of this package)
pidtree(-1, function (err, pids) {
  console.log(pids)
  // => [530, 42, ..., 41241]
})

// Include PPID in the results
pidtree(1, {advanced: true}, function (err, pids) {
  console.log(pids)
  // => [{ppid: 1, pid: 530}, {ppid: 1, pid: 42}, ..., {ppid: 1, pid: 41241}]
})

// If no callback is given it returns a promise instead
const pids = await pidtree(1)
console.log(pids)
// => [141, 42, ..., 15242]

Compatibility

Linux FreeBSD NetBSD SunOS macOS Win AIX
βœ… ❓ ❓ ❓ βœ… βœ… ❓

βœ… = Working ❓ = Not tested but should work

Please if your platform is not supported file an issue.

CLI

pidtree cli

Show a tree of the processes inside your system inside your terminal.
npx pidtree $PPID

Just replace $PPID with one of the pids inside your system.

Or don't pass anything if you want all the pids inside your system.

npx pidtree

To display the output as a list, similar to the one produced from pgrep -P $PID, pass the --list flag.

npx pidtree --list

API

pidtree(pid, [options], [callback]) β‡’ [Promise.<Array.<Object>>]

Get the list of children pids of the given pid.

Kind: global function
Returns: Promise.<Array.<Object>> - Only when the callback is not provided.
Access: public

Param Type Default Description
pid Number | String A pid. If -1 will return all the pids.
[options] Object Optional options object.
[options.root] Boolean false Include the provided pid in the list. Ignored if -1 is passed as pid.
[callback] function Called when the list is ready. If not provided a promise is returned instead.

Related

  • pidusage - Cross-platform process cpu % and memory usage of a PID

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the license file for details.

More Repositories

1

geo-maps

πŸ—Ί High Quality GeoJSON maps programmatically generated.
JavaScript
1,225
star
2

upash

πŸ”’Unified API for password hashing algorithms
JavaScript
529
star
3

sympact

πŸ”₯ Stupid Simple CPU/MEM "Profiler" for your JS code.
JavaScript
439
star
4

lm-scorer

πŸ“ƒLanguage Model based sentences scoring library
Python
296
star
5

datasets-knowledge-embedding

πŸ“ A collection of common datasets used in knowledge embedding
Shell
145
star
6

country-iso

πŸ—Ί Get the ISO 3166-1 alpha-3 country code from geographic coordinates.
JavaScript
142
star
7

geojson-geometries-lookup

⚑️ Fast geometry in geometry lookup for large GeoJSONs.
JavaScript
88
star
8

osm-geojson

πŸ”° Get GeoJSON of a OpenStreetMap's relation from the API.
JavaScript
48
star
9

is-sea

🌊 Check whether a geographic coordinate is in the sea or not on the earth.
JavaScript
46
star
10

env-dot-prop

♻️ Get, set, or delete nested properties of process.env using a dot path
JavaScript
33
star
11

roboprime

πŸ€– Full featured 21 DOF 3D Printed Humanoid Robot based on ATmega328P chip
Arduino
23
star
12

competitive-programming

πŸ… This repository contains all the problems I solved while training myself for programming competitions
C++
21
star
13

phc-argon2

πŸ”’ Node.JS Argon2 password hashing algorithm following the PHC string format.
JavaScript
17
star
14

fitbit2garmin

⬇ Downloads lifetime Fitbit data and exports it into the format supported by Garmin Connect data importer. This includes historical body composition data (weight, BMI, and fat percentage), activity data (calories burned, steps, distance, active minutes, and floors climbed), and individual GPS exercises (TCX).
Python
16
star
15

upash-cli

🌌 Hash password directly from your terminal
JavaScript
15
star
16

phc-format

πŸ“ PHC String Format implementation for Node.JS
JavaScript
14
star
17

ni

πŸ“¦ A better `npm init` **NOT RELEASED**
JavaScript
12
star
18

phc-pbkdf2

πŸ”’ Node.JS PBKDF2 password hashing algorithm following the PHC string format.
JavaScript
12
star
19

osm-countries

πŸ”Ž Get the OpenStreetMap's relation id from a country code.
JavaScript
11
star
20

project-version

πŸ‘€ Get the current version of your project.
JavaScript
10
star
21

fever-transformers

πŸ“„ Evidence Retrieval and Claim Verification for the FEVER shared task using Transformer Networks
Python
10
star
22

varname-seq2seq

πŸ“„Source code variable naming using a seq2seq architecture
Python
9
star
23

leadoii

πŸ† Leaderboard Generator for the Italian Olympiads of Informatics Training Platform
Vue
8
star
24

bin-manager

πŸŒ€ Binaries available as local nodeJS dependencies
JavaScript
7
star
25

phc-bcrypt

πŸ”’ Easy to use Unified API for bcrypt password hashing algorithm
JavaScript
6
star
26

phc-scrypt

πŸ”’ Node.JS scrypt password hashing algorithm following the PHC string format.
JavaScript
6
star
27

act

✏️ Multi-purpose URI tracker.
JavaScript
6
star
28

tsse

⏱ Timing safe string equals.
JavaScript
3
star
29

text-tokenizers-colab

πŸ”ͺ Tokenize text on the fly on Colab.
Jupyter Notebook
3
star
30

restify-errors-options

πŸ”§ Add custom options to Restify's errors
JavaScript
3
star
31

leadoii-static

πŸ…Pre-Generated Leaderboards of the Italian Olympiads of Informatics Training Platform Users
HTML
3
star
32

sudoku-solver

πŸ”’ Sudoku Solutions Enumerator (Sequential and Parallel)
Java
2
star
33

restify-errors-thrower

πŸ’₯ Throw Restify errors easily!
JavaScript
2
star
34

kdf-salt

🎲 Crypto secure salt generator
JavaScript
2
star
35

docker-osrm-backend

πŸ›£ The Open Source Routing Machine Docker ready!
Shell
2
star
36

geojson-geometries

⛏ Extract elementary geometries from a GeoJSON inheriting properties.
JavaScript
2
star
37

css-viewport-units-cross-browser

Cross-Browser CSS3 Viewport Units: (vh, vw, vmin, vmax)
CSS
2
star
38

talking-unicorn

πŸ¦„ An Arduino based greating unicorn.
Arduino
2
star
39

text2error

γ€° Introduce errors in error free text
Python
2
star
40

edgelist-mapper

πŸ“ŠMaps nodes and edges of a multi-relational graph to integer
Python
1
star
41

ardutank

πŸš— An Arduino based rover
C++
1
star
42

restify-errors-options-errno

☎️ Add errno to Restify's errors
JavaScript
1
star
43

rgcn-link-prediction-experiments

1
star