@@ -76,8 +76,17 @@ const [
76
76
const getHomeDirectory = getCheckedFunction ( _getHomeDirectory ) ;
77
77
const getHostname = getCheckedFunction ( _getHostname ) ;
78
78
const getInterfaceAddresses = getCheckedFunction ( _getInterfaceAddresses ) ;
79
+ /**
80
+ * @returns {string }
81
+ */
79
82
const getOSRelease = ( ) => release ;
83
+ /**
84
+ * @returns {string }
85
+ */
80
86
const getOSType = ( ) => type ;
87
+ /**
88
+ * @returns {string }
89
+ */
81
90
const getOSVersion = ( ) => version ;
82
91
83
92
getFreeMem [ SymbolToPrimitive ] = ( ) => getFreeMem ( ) ;
@@ -93,11 +102,30 @@ const kEndianness = isBigEndian ? 'BE' : 'LE';
93
102
94
103
const avgValues = new Float64Array ( 3 ) ;
95
104
105
+ /**
106
+ * @returns {[number, number, number] }
107
+ */
96
108
function loadavg ( ) {
97
109
getLoadAvg ( avgValues ) ;
98
110
return [ avgValues [ 0 ] , avgValues [ 1 ] , avgValues [ 2 ] ] ;
99
111
}
100
112
113
+ /**
114
+ * Returns an array of objects containing information about each
115
+ * logical CPU core.
116
+ *
117
+ * @returns {Array<{
118
+ * model: string
119
+ * speed: number
120
+ * times: {
121
+ * user: number
122
+ * nice: number
123
+ * sys: number
124
+ * idle: number
125
+ * irq: number
126
+ * }
127
+ * }> }
128
+ */
101
129
function cpus ( ) {
102
130
// [] is a bugfix for a regression introduced in 51cea61
103
131
const data = getCPUs ( ) || [ ] ;
@@ -119,16 +147,25 @@ function cpus() {
119
147
return result ;
120
148
}
121
149
150
+ /**
151
+ * @returns {string }
152
+ */
122
153
function arch ( ) {
123
154
return process . arch ;
124
155
}
125
156
arch [ SymbolToPrimitive ] = ( ) => process . arch ;
126
157
158
+ /**
159
+ * @returns {string }
160
+ */
127
161
function platform ( ) {
128
162
return process . platform ;
129
163
}
130
164
platform [ SymbolToPrimitive ] = ( ) => process . platform ;
131
165
166
+ /**
167
+ * @returns {string }
168
+ */
132
169
function tmpdir ( ) {
133
170
var path ;
134
171
if ( isWindows ) {
@@ -150,6 +187,9 @@ function tmpdir() {
150
187
}
151
188
tmpdir [ SymbolToPrimitive ] = ( ) => tmpdir ( ) ;
152
189
190
+ /**
191
+ * @returns {'BE' | 'LE' }
192
+ */
153
193
function endianness ( ) {
154
194
return kEndianness ;
155
195
}
@@ -199,6 +239,17 @@ function getCIDR(address, netmask, family) {
199
239
return `${ address } /${ ones } ` ;
200
240
}
201
241
242
+ /**
243
+ * @returns {Record<string, Array<{
244
+ * address: string
245
+ * netmask: string
246
+ * family: 'IPv4' | 'IPv6'
247
+ * mac: string
248
+ * internal: boolean
249
+ * scopeid: number
250
+ * cidr: string | null
251
+ * }>>}
252
+ */
202
253
function networkInterfaces ( ) {
203
254
const data = getInterfaceAddresses ( ) ;
204
255
const result = { } ;
@@ -229,6 +280,11 @@ function networkInterfaces() {
229
280
return result ;
230
281
}
231
282
283
+ /**
284
+ * @param {number } pid
285
+ * @param {number } priority
286
+ * @returns {void }
287
+ */
232
288
function setPriority ( pid , priority ) {
233
289
if ( priority === undefined ) {
234
290
priority = pid ;
@@ -244,6 +300,10 @@ function setPriority(pid, priority) {
244
300
throw new ERR_SYSTEM_ERROR ( ctx ) ;
245
301
}
246
302
303
+ /**
304
+ * @param {number } pid
305
+ * @returns {number }
306
+ */
247
307
function getPriority ( pid ) {
248
308
if ( pid === undefined )
249
309
pid = 0 ;
@@ -259,6 +319,18 @@ function getPriority(pid) {
259
319
return priority ;
260
320
}
261
321
322
+ /**
323
+ * @param {{ encoding?: string } } options If `encoding` is set to `'buffer'`,
324
+ * the `username`, `shell`, and `homedir` values will be `Buffer` instances.
325
+ * Default: `'utf8'`
326
+ * @returns {{
327
+ * uid: number
328
+ * gid: number
329
+ * username: string
330
+ * homedir: string
331
+ * shell: string | null
332
+ * }}
333
+ */
262
334
function userInfo ( options ) {
263
335
if ( typeof options !== 'object' )
264
336
options = null ;
0 commit comments