-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.d.ts
80 lines (72 loc) · 2.03 KB
/
index.d.ts
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
declare namespace PidTree {
export interface Options {
/**
* Include the provided PID in the list. Ignored if -1 is passed as PID.
* @default false
*/
root?: boolean;
}
export interface AdvancedResult {
/**
* PID of the parent.
*/
ppid: number;
/**
* PID
*/
pid: number;
}
export type Result = number;
}
/**
* Get the list of children pids of the given pid.
* @param pid A PID. If -1 will return all the pids.
* @param callback Called when the list is ready.
*/
declare function pidtree(
pid: string | number,
callback: (error: Error | undefined, result: PidTree.Result[]) => void
): void;
/**
* Get the list of children pids of the given pid.
* @param pid A PID. If -1 will return all the pids.
* @param options Options object.
* @param callback Called when the list is ready.
*/
declare function pidtree(
pid: string | number,
options: PidTree.Options,
callback: (error: Error | undefined, result: PidTree.Result[]) => void
): void;
/**
* Get the list of children pids of the given pid.
* @param pid A PID. If -1 will return all the pids.
* @param options Options object.
* @param callback Called when the list is ready.
*/
declare function pidtree(
pid: string | number,
options: PidTree.Options & {advanced: true},
callback: (error: Error | undefined, result: PidTree.AdvancedResult[]) => void
): void;
/**
* Get the list of children pids of the given pid.
* @param pid A PID. If -1 will return all the pids.
* @param [options] Optional options object.
* @returns A promise containing the list.
*/
declare function pidtree(
pid: string | number,
options?: PidTree.Options
): Promise<PidTree.Result[]>;
/**
* Get the list of children pids of the given pid.
* @param pid A PID. If -1 will return all the pids.
* @param options Options object.
* @returns A promise containing the list.
*/
declare function pidtree(
pid: string | number,
options: PidTree.Options & {advanced: true}
): Promise<PidTree.AdvancedResult[]>;
export = pidtree;