File size: 3,085 Bytes
c2b7eb3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import constants from './lib/constants'
import errors from './lib/errors'

export { constants, errors }

export const EOL: '\r\n' | '\n'

export const devNull: '\\\\.\\nul' | '/dev/null'

export function platform(): 'android' | 'darwin' | 'ios' | 'linux' | 'win32'

export function arch(): 'arm' | 'arm64' | 'ia32' | 'x64'

export function type(): string

export function version(): string

export function release(): string

export function machine(): string

export function execPath(): string

export function pid(): number

export function ppid(): number

export function cwd(): string

export function chdir(dir: string): string

export function tmpdir(): string

export function homedir(): string

export function hostname(): string

export interface NetworkInterface {
  address: string
  netmask: string
  family: 'IPv4' | 'IPv6'
  cidr: string
  mac: string
  internal: boolean
  scopeid?: number
}

export function networkInterfaces(): Record<string, NetworkInterface[]>

export function kill(pid: number, signal?: string | number): void

export interface UserInfo {
  uid: number
  gid: number
  username: string
  homedir: string
  shell: string | null
}

export function userInfo(uid?: number): UserInfo

export interface GroupInfo {
  groupname: string
  gid: number
  members: string[]
}

export function groupInfo(gid?: number): GroupInfo | null

export function endianness(): 'LE' | 'BE'

export function availableParallelism(): number

export interface CpuUsage {
  user: number
  system: number
}

export function cpuUsage(previous?: CpuUsage): CpuUsage

export function threadCpuUsage(previous?: CpuUsage): CpuUsage

export function resourceUsage(): {
  userCPUTime: number
  systemCPUTime: number
  maxRSS: number
  sharedMemorySize: number
  unsharedDataSize: number
  unsharedStackSize: number
  minorPageFault: number
  majorPageFault: number
  swappedOut: number
  fsRead: number
  fsWrite: number
  ipcSent: number
  ipcReceived: number
  signalsCount: number
  voluntaryContextSwitches: number
  involuntaryContextSwitches: number
}

export function memoryUsage(): {
  rss: number
  heapTotal: number
  heapUsed: number
  external: number
}

export function freemem(): number

export function totalmem(): number

export function availableMemory(): number

export function constrainedMemory(): number

export function uptime(): number

export function loadavg(): ArrayLike<number>

export function cpus(): {
  model: string
  speed: number
  times: {
    user: number
    nice: number
    sys: number
    idle: number
    irq: number
  }
}[]

export function getProcessTitle(): string

export function setProcessTitle(title: unknown): void

export function getPriority(pid?: number): number

export function setPriority(priority: number): void
export function setPriority(pid: number, priority: number): void

export function getEnvKeys(): string[]

export function getEnv(name: string): string | undefined

export function hasEnv(name: string): boolean

export function setEnv(name: string, value: string): void

export function unsetEnv(name: string): void