| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8acfe5c commit d97787f
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -80,8 +80,17 @@ const { | |||
| 80 | 80 | const getHomeDirectory = getCheckedFunction(_getHomeDirectory); | |
| 81 | 81 | const getHostname = getCheckedFunction(_getHostname); | |
| 82 | 82 | const getInterfaceAddresses = getCheckedFunction(_getInterfaceAddresses); | |
| 83 | + /** | ||
| 84 | + * @returns {string} | ||
| 85 | + */ | ||
| 83 | 86 | const getOSRelease = () => release; | |
| 87 | + /** | ||
| 88 | + * @returns {string} | ||
| 89 | + */ | ||
| 84 | 90 | const getOSType = () => type; | |
| 91 | + /** | ||
| 92 | + * @returns {string} | ||
| 93 | + */ | ||
| 85 | 94 | const getOSVersion = () => version; | |
| 86 | 95 | ||
| 87 | 96 | getFreeMem[SymbolToPrimitive] = () => getFreeMem(); | |
@@ -97,11 +106,30 @@ const kEndianness = isBigEndian ? 'BE' : 'LE'; | |||
| 97 | 106 | ||
| 98 | 107 | const avgValues = new Float64Array(3); | |
| 99 | 108 | ||
| 109 | + /** | ||
| 110 | + * @returns {[number, number, number]} | ||
| 111 | + */ | ||
| 100 | 112 | function loadavg() { | |
| 101 | 113 | getLoadAvg(avgValues); | |
| 102 | 114 | return [avgValues[0], avgValues[1], avgValues[2]]; | |
| 103 | 115 | } | |
| 104 | 116 | ||
| 117 | + /** | ||
| 118 | + * Returns an array of objects containing information about each | ||
| 119 | + * logical CPU core. | ||
| 120 | + * | ||
| 121 | + * @returns {Array<{ | ||
| 122 | + * model: string | ||
| 123 | + * speed: number | ||
| 124 | + * times: { | ||
| 125 | + * user: number | ||
| 126 | + * nice: number | ||
| 127 | + * sys: number | ||
| 128 | + * idle: number | ||
| 129 | + * irq: number | ||
| 130 | + * } | ||
| 131 | + * }>} | ||
| 132 | + */ | ||
| 105 | 133 | function cpus() { | |
| 106 | 134 | // [] is a bugfix for a regression introduced in 51cea61 | |
| 107 | 135 | const data = getCPUs() || []; | |
@@ -123,16 +151,25 @@ function cpus() { | |||
| 123 | 151 | return result; | |
| 124 | 152 | } | |
| 125 | 153 | ||
| 154 | + /** | ||
| 155 | + * @returns {string} | ||
| 156 | + */ | ||
| 126 | 157 | function arch() { | |
| 127 | 158 | return process.arch; | |
| 128 | 159 | } | |
| 129 | 160 | arch[SymbolToPrimitive] = () => process.arch; | |
| 130 | 161 | ||
| 162 | + /** | ||
| 163 | + * @returns {string} | ||
| 164 | + */ | ||
| 131 | 165 | function platform() { | |
| 132 | 166 | return process.platform; | |
| 133 | 167 | } | |
| 134 | 168 | platform[SymbolToPrimitive] = () => process.platform; | |
| 135 | 169 | ||
| 170 | + /** | ||
| 171 | + * @returns {string} | ||
| 172 | + */ | ||
| 136 | 173 | function tmpdir() { | |
| 137 | 174 | var path; | |
| 138 | 175 | if (isWindows) { | |
@@ -155,6 +192,9 @@ function tmpdir() { | |||
| 155 | 192 | } | |
| 156 | 193 | tmpdir[SymbolToPrimitive] = () => tmpdir(); | |
| 157 | 194 | ||
| 195 | + /** | ||
| 196 | + * @returns {'BE' | 'LE'} | ||
| 197 | + */ | ||
| 158 | 198 | function endianness() { | |
| 159 | 199 | return kEndianness; | |
| 160 | 200 | } | |
@@ -204,6 +244,17 @@ function getCIDR(address, netmask, family) { | |||
| 204 | 244 | return `${address}/${ones}`; | |
| 205 | 245 | } | |
| 206 | 246 | ||
| 247 | + /** | ||
| 248 | + * @returns {Record<string, Array<{ | ||
| 249 | + * address: string | ||
| 250 | + * netmask: string | ||
| 251 | + * family: 'IPv4' | 'IPv6' | ||
| 252 | + * mac: string | ||
| 253 | + * internal: boolean | ||
| 254 | + * scopeid: number | ||
| 255 | + * cidr: string | null | ||
| 256 | + * }>>} | ||
| 257 | + */ | ||
| 207 | 258 | function networkInterfaces() { | |
| 208 | 259 | const data = getInterfaceAddresses(); | |
| 209 | 260 | const result = {}; | |
@@ -234,6 +285,11 @@ function networkInterfaces() { | |||
| 234 | 285 | return result; | |
| 235 | 286 | } | |
| 236 | 287 | ||
| 288 | + /** | ||
| 289 | + * @param {number} pid | ||
| 290 | + * @param {number} priority | ||
| 291 | + * @returns {void} | ||
| 292 | + */ | ||
| 237 | 293 | function setPriority(pid, priority) { | |
| 238 | 294 | if (priority === undefined) { | |
| 239 | 295 | priority = pid; | |
@@ -249,6 +305,10 @@ function setPriority(pid, priority) { | |||
| 249 | 305 | throw new ERR_SYSTEM_ERROR(ctx); | |
| 250 | 306 | } | |
| 251 | 307 | ||
| 308 | + /** | ||
| 309 | + * @param {number} pid | ||
| 310 | + * @returns {number} | ||
| 311 | + */ | ||
| 252 | 312 | function getPriority(pid) { | |
| 253 | 313 | if (pid === undefined) | |
| 254 | 314 | pid = 0; | |
@@ -264,6 +324,18 @@ function getPriority(pid) { | |||
| 264 | 324 | return priority; | |
| 265 | 325 | } | |
| 266 | 326 | ||
| 327 | + /** | ||
| 328 | + * @param {{ encoding?: string }} options If `encoding` is set to `'buffer'`, | ||
| 329 | + * the `username`, `shell`, and `homedir` values will be `Buffer` instances. | ||
| 330 | + * Default: `'utf8'` | ||
| 331 | + * @returns {{ | ||
| 332 | + * uid: number | ||
| 333 | + * gid: number | ||
| 334 | + * username: string | ||
| 335 | + * homedir: string | ||
| 336 | + * shell: string | null | ||
| 337 | + * }} | ||
| 338 | + */ | ||
| 267 | 339 | function userInfo(options) { | |
| 268 | 340 | if (typeof options !== 'object') | |
| 269 | 341 | options = null; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments