• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 # OS
2 
3 <!--introduced_in=v0.10.0-->
4 
5 > Stability: 2 - Stable
6 
7 <!-- source_link=lib/os.js -->
8 
9 The `os` module provides operating system-related utility methods and
10 properties. It can be accessed using:
11 
12 ```js
13 const os = require('os');
14 ```
15 
16 ## `os.EOL`
17 <!-- YAML
18 added: v0.7.8
19 -->
20 
21 * {string}
22 
23 The operating system-specific end-of-line marker.
24 
25 * `\n` on POSIX
26 * `\r\n` on Windows
27 
28 ## `os.arch()`
29 <!-- YAML
30 added: v0.5.0
31 -->
32 
33 * Returns: {string}
34 
35 Returns the operating system CPU architecture for which the Node.js binary was
36 compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,
37 `'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`.
38 
39 The return value is equivalent to [`process.arch`][].
40 
41 ## `os.constants`
42 <!-- YAML
43 added: v6.3.0
44 -->
45 
46 * {Object}
47 
48 Contains commonly used operating system-specific constants for error codes,
49 process signals, and so on. The specific constants defined are described in
50 [OS constants](#os_os_constants_1).
51 
52 ## `os.cpus()`
53 <!-- YAML
54 added: v0.3.3
55 -->
56 
57 * Returns: {Object[]}
58 
59 Returns an array of objects containing information about each logical CPU core.
60 
61 The properties included on each object include:
62 
63 * `model` {string}
64 * `speed` {number} (in MHz)
65 * `times` {Object}
66   * `user` {number} The number of milliseconds the CPU has spent in user mode.
67   * `nice` {number} The number of milliseconds the CPU has spent in nice mode.
68   * `sys` {number} The number of milliseconds the CPU has spent in sys mode.
69   * `idle` {number} The number of milliseconds the CPU has spent in idle mode.
70   * `irq` {number} The number of milliseconds the CPU has spent in irq mode.
71 
72 <!-- eslint-disable semi -->
73 ```js
74 [
75   {
76     model: 'Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz',
77     speed: 2926,
78     times: {
79       user: 252020,
80       nice: 0,
81       sys: 30340,
82       idle: 1070356870,
83       irq: 0
84     }
85   },
86   {
87     model: 'Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz',
88     speed: 2926,
89     times: {
90       user: 306960,
91       nice: 0,
92       sys: 26980,
93       idle: 1071569080,
94       irq: 0
95     }
96   },
97   {
98     model: 'Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz',
99     speed: 2926,
100     times: {
101       user: 248450,
102       nice: 0,
103       sys: 21750,
104       idle: 1070919370,
105       irq: 0
106     }
107   },
108   {
109     model: 'Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz',
110     speed: 2926,
111     times: {
112       user: 256880,
113       nice: 0,
114       sys: 19430,
115       idle: 1070905480,
116       irq: 20
117     }
118   },
119 ]
120 ```
121 
122 `nice` values are POSIX-only. On Windows, the `nice` values of all processors
123 are always 0.
124 
125 ## `os.devNull`
126 <!-- YAML
127 added: v14.18.0
128 -->
129 
130 * {string}
131 
132 The platform-specific file path of the null device.
133 
134 * `\\.\nul` on Windows
135 * `/dev/null` on POSIX
136 
137 ## `os.endianness()`
138 <!-- YAML
139 added: v0.9.4
140 -->
141 
142 * Returns: {string}
143 
144 Returns a string identifying the endianness of the CPU for which the Node.js
145 binary was compiled.
146 
147 Possible values are `'BE'` for big endian and `'LE'` for little endian.
148 
149 ## `os.freemem()`
150 <!-- YAML
151 added: v0.3.3
152 -->
153 
154 * Returns: {integer}
155 
156 Returns the amount of free system memory in bytes as an integer.
157 
158 ## `os.getPriority([pid])`
159 <!-- YAML
160 added: v10.10.0
161 -->
162 
163 * `pid` {integer} The process ID to retrieve scheduling priority for.
164   **Default** `0`.
165 * Returns: {integer}
166 
167 Returns the scheduling priority for the process specified by `pid`. If `pid` is
168 not provided or is `0`, the priority of the current process is returned.
169 
170 ## `os.homedir()`
171 <!-- YAML
172 added: v2.3.0
173 -->
174 
175 * Returns: {string}
176 
177 Returns the string path of the current user's home directory.
178 
179 On POSIX, it uses the `$HOME` environment variable if defined. Otherwise it
180 uses the [effective UID][EUID] to look up the user's home directory.
181 
182 On Windows, it uses the `USERPROFILE` environment variable if defined.
183 Otherwise it uses the path to the profile directory of the current user.
184 
185 ## `os.hostname()`
186 <!-- YAML
187 added: v0.3.3
188 -->
189 
190 * Returns: {string}
191 
192 Returns the host name of the operating system as a string.
193 
194 ## `os.loadavg()`
195 <!-- YAML
196 added: v0.3.3
197 -->
198 
199 * Returns: {number[]}
200 
201 Returns an array containing the 1, 5, and 15 minute load averages.
202 
203 The load average is a measure of system activity calculated by the operating
204 system and expressed as a fractional number.
205 
206 The load average is a Unix-specific concept. On Windows, the return value is
207 always `[0, 0, 0]`.
208 
209 ## `os.networkInterfaces()`
210 <!-- YAML
211 added: v0.6.0
212 -->
213 
214 * Returns: {Object}
215 
216 Returns an object containing network interfaces that have been assigned a
217 network address.
218 
219 Each key on the returned object identifies a network interface. The associated
220 value is an array of objects that each describe an assigned network address.
221 
222 The properties available on the assigned network address object include:
223 
224 * `address` {string} The assigned IPv4 or IPv6 address
225 * `netmask` {string} The IPv4 or IPv6 network mask
226 * `family` {string} Either `IPv4` or `IPv6`
227 * `mac` {string} The MAC address of the network interface
228 * `internal` {boolean} `true` if the network interface is a loopback or
229   similar interface that is not remotely accessible; otherwise `false`
230 * `scopeid` {number} The numeric IPv6 scope ID (only specified when `family`
231   is `IPv6`)
232 * `cidr` {string} The assigned IPv4 or IPv6 address with the routing prefix
233   in CIDR notation. If the `netmask` is invalid, this property is set
234   to `null`.
235 
236 <!-- eslint-skip -->
237 ```js
238 {
239   lo: [
240     {
241       address: '127.0.0.1',
242       netmask: '255.0.0.0',
243       family: 'IPv4',
244       mac: '00:00:00:00:00:00',
245       internal: true,
246       cidr: '127.0.0.1/8'
247     },
248     {
249       address: '::1',
250       netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
251       family: 'IPv6',
252       mac: '00:00:00:00:00:00',
253       scopeid: 0,
254       internal: true,
255       cidr: '::1/128'
256     }
257   ],
258   eth0: [
259     {
260       address: '192.168.1.108',
261       netmask: '255.255.255.0',
262       family: 'IPv4',
263       mac: '01:02:03:0a:0b:0c',
264       internal: false,
265       cidr: '192.168.1.108/24'
266     },
267     {
268       address: 'fe80::a00:27ff:fe4e:66a1',
269       netmask: 'ffff:ffff:ffff:ffff::',
270       family: 'IPv6',
271       mac: '01:02:03:0a:0b:0c',
272       scopeid: 1,
273       internal: false,
274       cidr: 'fe80::a00:27ff:fe4e:66a1/64'
275     }
276   ]
277 }
278 ```
279 
280 ## `os.platform()`
281 <!-- YAML
282 added: v0.5.0
283 -->
284 
285 * Returns: {string}
286 
287 Returns a string identifying the operating system platform. The value is set
288 at compile time. Possible values are `'aix'`, `'darwin'`, `'freebsd'`,
289 `'linux'`, `'openbsd'`, `'sunos'`, and `'win32'`.
290 
291 The return value is equivalent to [`process.platform`][].
292 
293 The value `'android'` may also be returned if Node.js is built on the Android
294 operating system. [Android support is experimental][Android building].
295 
296 ## `os.release()`
297 <!-- YAML
298 added: v0.3.3
299 -->
300 
301 * Returns: {string}
302 
303 Returns the operating system as a string.
304 
305 On POSIX systems, the operating system release is determined by calling
306 [`uname(3)`][]. On Windows, `GetVersionExW()` is used. See
307 <https://en.wikipedia.org/wiki/Uname#Examples> for more information.
308 
309 ## `os.setPriority([pid, ]priority)`
310 <!-- YAML
311 added: v10.10.0
312 -->
313 
314 * `pid` {integer} The process ID to set scheduling priority for.
315   **Default** `0`.
316 * `priority` {integer} The scheduling priority to assign to the process.
317 
318 Attempts to set the scheduling priority for the process specified by `pid`. If
319 `pid` is not provided or is `0`, the process ID of the current process is used.
320 
321 The `priority` input must be an integer between `-20` (high priority) and `19`
322 (low priority). Due to differences between Unix priority levels and Windows
323 priority classes, `priority` is mapped to one of six priority constants in
324 `os.constants.priority`. When retrieving a process priority level, this range
325 mapping may cause the return value to be slightly different on Windows. To avoid
326 confusion, set `priority` to one of the priority constants.
327 
328 On Windows, setting priority to `PRIORITY_HIGHEST` requires elevated user
329 privileges. Otherwise the set priority will be silently reduced to
330 `PRIORITY_HIGH`.
331 
332 ## `os.tmpdir()`
333 <!-- YAML
334 added: v0.9.9
335 changes:
336   - version: v2.0.0
337     pr-url: https://github.com/nodejs/node/pull/747
338     description: This function is now cross-platform consistent and no longer
339                  returns a path with a trailing slash on any platform.
340 -->
341 
342 * Returns: {string}
343 
344 Returns the operating system's default directory for temporary files as a
345 string.
346 
347 ## `os.totalmem()`
348 <!-- YAML
349 added: v0.3.3
350 -->
351 
352 * Returns: {integer}
353 
354 Returns the total amount of system memory in bytes as an integer.
355 
356 ## `os.type()`
357 <!-- YAML
358 added: v0.3.3
359 -->
360 
361 * Returns: {string}
362 
363 Returns the operating system name as returned by [`uname(3)`][]. For example, it
364 returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.
365 
366 See <https://en.wikipedia.org/wiki/Uname#Examples> for additional information
367 about the output of running [`uname(3)`][] on various operating systems.
368 
369 ## `os.uptime()`
370 <!-- YAML
371 added: v0.3.3
372 changes:
373   - version: v10.0.0
374     pr-url: https://github.com/nodejs/node/pull/20129
375     description: The result of this function no longer contains a fraction
376                  component on Windows.
377 -->
378 
379 * Returns: {integer}
380 
381 Returns the system uptime in number of seconds.
382 
383 ## `os.userInfo([options])`
384 <!-- YAML
385 added: v6.0.0
386 -->
387 
388 * `options` {Object}
389   * `encoding` {string} Character encoding used to interpret resulting strings.
390     If `encoding` is set to `'buffer'`, the `username`, `shell`, and `homedir`
391     values will be `Buffer` instances. **Default:** `'utf8'`.
392 * Returns: {Object}
393 
394 Returns information about the currently effective user. On POSIX platforms,
395 this is typically a subset of the password file. The returned object includes
396 the `username`, `uid`, `gid`, `shell`, and `homedir`. On Windows, the `uid` and
397 `gid` fields are `-1`, and `shell` is `null`.
398 
399 The value of `homedir` returned by `os.userInfo()` is provided by the operating
400 system. This differs from the result of `os.homedir()`, which queries
401 environment variables for the home directory before falling back to the
402 operating system response.
403 
404 Throws a [`SystemError`][] if a user has no `username` or `homedir`.
405 
406 ## `os.version()`
407 <!-- YAML
408 added: v13.11.0
409 -->
410 
411 * Returns {string}
412 
413 Returns a string identifying the kernel version.
414 
415 On POSIX systems, the operating system release is determined by calling
416 [`uname(3)`][]. On Windows, `RtlGetVersion()` is used, and if it is not
417 available, `GetVersionExW()` will be used. See
418 <https://en.wikipedia.org/wiki/Uname#Examples> for more information.
419 
420 ## OS constants
421 
422 The following constants are exported by `os.constants`.
423 
424 Not all constants will be available on every operating system.
425 
426 ### Signal constants
427 <!-- YAML
428 changes:
429   - version: v5.11.0
430     pr-url: https://github.com/nodejs/node/pull/6093
431     description: Added support for `SIGINFO`.
432 -->
433 
434 The following signal constants are exported by `os.constants.signals`.
435 
436 <table>
437   <tr>
438     <th>Constant</th>
439     <th>Description</th>
440   </tr>
441   <tr>
442     <td><code>SIGHUP</code></td>
443     <td>Sent to indicate when a controlling terminal is closed or a parent
444     process exits.</td>
445   </tr>
446   <tr>
447     <td><code>SIGINT</code></td>
448     <td>Sent to indicate when a user wishes to interrupt a process
449     (<kbd>Ctrl</kbd>+<kbd>C</kbd>).</td>
450   </tr>
451   <tr>
452     <td><code>SIGQUIT</code></td>
453     <td>Sent to indicate when a user wishes to terminate a process and perform a
454     core dump.</td>
455   </tr>
456   <tr>
457     <td><code>SIGILL</code></td>
458     <td>Sent to a process to notify that it has attempted to perform an illegal,
459     malformed, unknown, or privileged instruction.</td>
460   </tr>
461   <tr>
462     <td><code>SIGTRAP</code></td>
463     <td>Sent to a process when an exception has occurred.</td>
464   </tr>
465   <tr>
466     <td><code>SIGABRT</code></td>
467     <td>Sent to a process to request that it abort.</td>
468   </tr>
469   <tr>
470     <td><code>SIGIOT</code></td>
471     <td>Synonym for <code>SIGABRT</code></td>
472   </tr>
473   <tr>
474     <td><code>SIGBUS</code></td>
475     <td>Sent to a process to notify that it has caused a bus error.</td>
476   </tr>
477   <tr>
478     <td><code>SIGFPE</code></td>
479     <td>Sent to a process to notify that it has performed an illegal arithmetic
480     operation.</td>
481   </tr>
482   <tr>
483     <td><code>SIGKILL</code></td>
484     <td>Sent to a process to terminate it immediately.</td>
485   </tr>
486   <tr>
487     <td><code>SIGUSR1</code> <code>SIGUSR2</code></td>
488     <td>Sent to a process to identify user-defined conditions.</td>
489   </tr>
490   <tr>
491     <td><code>SIGSEGV</code></td>
492     <td>Sent to a process to notify of a segmentation fault.</td>
493   </tr>
494   <tr>
495     <td><code>SIGPIPE</code></td>
496     <td>Sent to a process when it has attempted to write to a disconnected
497     pipe.</td>
498   </tr>
499   <tr>
500     <td><code>SIGALRM</code></td>
501     <td>Sent to a process when a system timer elapses.</td>
502   </tr>
503   <tr>
504     <td><code>SIGTERM</code></td>
505     <td>Sent to a process to request termination.</td>
506   </tr>
507   <tr>
508     <td><code>SIGCHLD</code></td>
509     <td>Sent to a process when a child process terminates.</td>
510   </tr>
511   <tr>
512     <td><code>SIGSTKFLT</code></td>
513     <td>Sent to a process to indicate a stack fault on a coprocessor.</td>
514   </tr>
515   <tr>
516     <td><code>SIGCONT</code></td>
517     <td>Sent to instruct the operating system to continue a paused process.</td>
518   </tr>
519   <tr>
520     <td><code>SIGSTOP</code></td>
521     <td>Sent to instruct the operating system to halt a process.</td>
522   </tr>
523   <tr>
524     <td><code>SIGTSTP</code></td>
525     <td>Sent to a process to request it to stop.</td>
526   </tr>
527   <tr>
528     <td><code>SIGBREAK</code></td>
529     <td>Sent to indicate when a user wishes to interrupt a process.</td>
530   </tr>
531   <tr>
532     <td><code>SIGTTIN</code></td>
533     <td>Sent to a process when it reads from the TTY while in the
534     background.</td>
535   </tr>
536   <tr>
537     <td><code>SIGTTOU</code></td>
538     <td>Sent to a process when it writes to the TTY while in the
539     background.</td>
540   </tr>
541   <tr>
542     <td><code>SIGURG</code></td>
543     <td>Sent to a process when a socket has urgent data to read.</td>
544   </tr>
545   <tr>
546     <td><code>SIGXCPU</code></td>
547     <td>Sent to a process when it has exceeded its limit on CPU usage.</td>
548   </tr>
549   <tr>
550     <td><code>SIGXFSZ</code></td>
551     <td>Sent to a process when it grows a file larger than the maximum
552     allowed.</td>
553   </tr>
554   <tr>
555     <td><code>SIGVTALRM</code></td>
556     <td>Sent to a process when a virtual timer has elapsed.</td>
557   </tr>
558   <tr>
559     <td><code>SIGPROF</code></td>
560     <td>Sent to a process when a system timer has elapsed.</td>
561   </tr>
562   <tr>
563     <td><code>SIGWINCH</code></td>
564     <td>Sent to a process when the controlling terminal has changed its
565     size.</td>
566   </tr>
567   <tr>
568     <td><code>SIGIO</code></td>
569     <td>Sent to a process when I/O is available.</td>
570   </tr>
571   <tr>
572     <td><code>SIGPOLL</code></td>
573     <td>Synonym for <code>SIGIO</code></td>
574   </tr>
575   <tr>
576     <td><code>SIGLOST</code></td>
577     <td>Sent to a process when a file lock has been lost.</td>
578   </tr>
579   <tr>
580     <td><code>SIGPWR</code></td>
581     <td>Sent to a process to notify of a power failure.</td>
582   </tr>
583   <tr>
584     <td><code>SIGINFO</code></td>
585     <td>Synonym for <code>SIGPWR</code></td>
586   </tr>
587   <tr>
588     <td><code>SIGSYS</code></td>
589     <td>Sent to a process to notify of a bad argument.</td>
590   </tr>
591   <tr>
592     <td><code>SIGUNUSED</code></td>
593     <td>Synonym for <code>SIGSYS</code></td>
594   </tr>
595 </table>
596 
597 ### Error constants
598 
599 The following error constants are exported by `os.constants.errno`.
600 
601 #### POSIX error constants
602 
603 <table>
604   <tr>
605     <th>Constant</th>
606     <th>Description</th>
607   </tr>
608   <tr>
609     <td><code>E2BIG</code></td>
610     <td>Indicates that the list of arguments is longer than expected.</td>
611   </tr>
612   <tr>
613     <td><code>EACCES</code></td>
614     <td>Indicates that the operation did not have sufficient permissions.</td>
615   </tr>
616   <tr>
617     <td><code>EADDRINUSE</code></td>
618     <td>Indicates that the network address is already in use.</td>
619   </tr>
620   <tr>
621     <td><code>EADDRNOTAVAIL</code></td>
622     <td>Indicates that the network address is currently unavailable for
623     use.</td>
624   </tr>
625   <tr>
626     <td><code>EAFNOSUPPORT</code></td>
627     <td>Indicates that the network address family is not supported.</td>
628   </tr>
629   <tr>
630     <td><code>EAGAIN</code></td>
631     <td>Indicates that there is no data available and to try the
632     operation again later.</td>
633   </tr>
634   <tr>
635     <td><code>EALREADY</code></td>
636     <td>Indicates that the socket already has a pending connection in
637     progress.</td>
638   </tr>
639   <tr>
640     <td><code>EBADF</code></td>
641     <td>Indicates that a file descriptor is not valid.</td>
642   </tr>
643   <tr>
644     <td><code>EBADMSG</code></td>
645     <td>Indicates an invalid data message.</td>
646   </tr>
647   <tr>
648     <td><code>EBUSY</code></td>
649     <td>Indicates that a device or resource is busy.</td>
650   </tr>
651   <tr>
652     <td><code>ECANCELED</code></td>
653     <td>Indicates that an operation was canceled.</td>
654   </tr>
655   <tr>
656     <td><code>ECHILD</code></td>
657     <td>Indicates that there are no child processes.</td>
658   </tr>
659   <tr>
660     <td><code>ECONNABORTED</code></td>
661     <td>Indicates that the network connection has been aborted.</td>
662   </tr>
663   <tr>
664     <td><code>ECONNREFUSED</code></td>
665     <td>Indicates that the network connection has been refused.</td>
666   </tr>
667   <tr>
668     <td><code>ECONNRESET</code></td>
669     <td>Indicates that the network connection has been reset.</td>
670   </tr>
671   <tr>
672     <td><code>EDEADLK</code></td>
673     <td>Indicates that a resource deadlock has been avoided.</td>
674   </tr>
675   <tr>
676     <td><code>EDESTADDRREQ</code></td>
677     <td>Indicates that a destination address is required.</td>
678   </tr>
679   <tr>
680     <td><code>EDOM</code></td>
681     <td>Indicates that an argument is out of the domain of the function.</td>
682   </tr>
683   <tr>
684     <td><code>EDQUOT</code></td>
685     <td>Indicates that the disk quota has been exceeded.</td>
686   </tr>
687   <tr>
688     <td><code>EEXIST</code></td>
689     <td>Indicates that the file already exists.</td>
690   </tr>
691   <tr>
692     <td><code>EFAULT</code></td>
693     <td>Indicates an invalid pointer address.</td>
694   </tr>
695   <tr>
696     <td><code>EFBIG</code></td>
697     <td>Indicates that the file is too large.</td>
698   </tr>
699   <tr>
700     <td><code>EHOSTUNREACH</code></td>
701     <td>Indicates that the host is unreachable.</td>
702   </tr>
703   <tr>
704     <td><code>EIDRM</code></td>
705     <td>Indicates that the identifier has been removed.</td>
706   </tr>
707   <tr>
708     <td><code>EILSEQ</code></td>
709     <td>Indicates an illegal byte sequence.</td>
710   </tr>
711   <tr>
712     <td><code>EINPROGRESS</code></td>
713     <td>Indicates that an operation is already in progress.</td>
714   </tr>
715   <tr>
716     <td><code>EINTR</code></td>
717     <td>Indicates that a function call was interrupted.</td>
718   </tr>
719   <tr>
720     <td><code>EINVAL</code></td>
721     <td>Indicates that an invalid argument was provided.</td>
722   </tr>
723   <tr>
724     <td><code>EIO</code></td>
725     <td>Indicates an otherwise unspecified I/O error.</td>
726   </tr>
727   <tr>
728     <td><code>EISCONN</code></td>
729     <td>Indicates that the socket is connected.</td>
730   </tr>
731   <tr>
732     <td><code>EISDIR</code></td>
733     <td>Indicates that the path is a directory.</td>
734   </tr>
735   <tr>
736     <td><code>ELOOP</code></td>
737     <td>Indicates too many levels of symbolic links in a path.</td>
738   </tr>
739   <tr>
740     <td><code>EMFILE</code></td>
741     <td>Indicates that there are too many open files.</td>
742   </tr>
743   <tr>
744     <td><code>EMLINK</code></td>
745     <td>Indicates that there are too many hard links to a file.</td>
746   </tr>
747   <tr>
748     <td><code>EMSGSIZE</code></td>
749     <td>Indicates that the provided message is too long.</td>
750   </tr>
751   <tr>
752     <td><code>EMULTIHOP</code></td>
753     <td>Indicates that a multihop was attempted.</td>
754   </tr>
755   <tr>
756     <td><code>ENAMETOOLONG</code></td>
757     <td>Indicates that the filename is too long.</td>
758   </tr>
759   <tr>
760     <td><code>ENETDOWN</code></td>
761     <td>Indicates that the network is down.</td>
762   </tr>
763   <tr>
764     <td><code>ENETRESET</code></td>
765     <td>Indicates that the connection has been aborted by the network.</td>
766   </tr>
767   <tr>
768     <td><code>ENETUNREACH</code></td>
769     <td>Indicates that the network is unreachable.</td>
770   </tr>
771   <tr>
772     <td><code>ENFILE</code></td>
773     <td>Indicates too many open files in the system.</td>
774   </tr>
775   <tr>
776     <td><code>ENOBUFS</code></td>
777     <td>Indicates that no buffer space is available.</td>
778   </tr>
779   <tr>
780     <td><code>ENODATA</code></td>
781     <td>Indicates that no message is available on the stream head read
782     queue.</td>
783   </tr>
784   <tr>
785     <td><code>ENODEV</code></td>
786     <td>Indicates that there is no such device.</td>
787   </tr>
788   <tr>
789     <td><code>ENOENT</code></td>
790     <td>Indicates that there is no such file or directory.</td>
791   </tr>
792   <tr>
793     <td><code>ENOEXEC</code></td>
794     <td>Indicates an exec format error.</td>
795   </tr>
796   <tr>
797     <td><code>ENOLCK</code></td>
798     <td>Indicates that there are no locks available.</td>
799   </tr>
800   <tr>
801     <td><code>ENOLINK</code></td>
802     <td>Indications that a link has been severed.</td>
803   </tr>
804   <tr>
805     <td><code>ENOMEM</code></td>
806     <td>Indicates that there is not enough space.</td>
807   </tr>
808   <tr>
809     <td><code>ENOMSG</code></td>
810     <td>Indicates that there is no message of the desired type.</td>
811   </tr>
812   <tr>
813     <td><code>ENOPROTOOPT</code></td>
814     <td>Indicates that a given protocol is not available.</td>
815   </tr>
816   <tr>
817     <td><code>ENOSPC</code></td>
818     <td>Indicates that there is no space available on the device.</td>
819   </tr>
820   <tr>
821     <td><code>ENOSR</code></td>
822     <td>Indicates that there are no stream resources available.</td>
823   </tr>
824   <tr>
825     <td><code>ENOSTR</code></td>
826     <td>Indicates that a given resource is not a stream.</td>
827   </tr>
828   <tr>
829     <td><code>ENOSYS</code></td>
830     <td>Indicates that a function has not been implemented.</td>
831   </tr>
832   <tr>
833     <td><code>ENOTCONN</code></td>
834     <td>Indicates that the socket is not connected.</td>
835   </tr>
836   <tr>
837     <td><code>ENOTDIR</code></td>
838     <td>Indicates that the path is not a directory.</td>
839   </tr>
840   <tr>
841     <td><code>ENOTEMPTY</code></td>
842     <td>Indicates that the directory is not empty.</td>
843   </tr>
844   <tr>
845     <td><code>ENOTSOCK</code></td>
846     <td>Indicates that the given item is not a socket.</td>
847   </tr>
848   <tr>
849     <td><code>ENOTSUP</code></td>
850     <td>Indicates that a given operation is not supported.</td>
851   </tr>
852   <tr>
853     <td><code>ENOTTY</code></td>
854     <td>Indicates an inappropriate I/O control operation.</td>
855   </tr>
856   <tr>
857     <td><code>ENXIO</code></td>
858     <td>Indicates no such device or address.</td>
859   </tr>
860   <tr>
861     <td><code>EOPNOTSUPP</code></td>
862     <td>Indicates that an operation is not supported on the socket. Although
863     <code>ENOTSUP</code> and <code>EOPNOTSUPP</code> have the same value
864     on Linux, according to POSIX.1 these error values should be distinct.)</td>
865   </tr>
866   <tr>
867     <td><code>EOVERFLOW</code></td>
868     <td>Indicates that a value is too large to be stored in a given data
869     type.</td>
870   </tr>
871   <tr>
872     <td><code>EPERM</code></td>
873     <td>Indicates that the operation is not permitted.</td>
874   </tr>
875   <tr>
876     <td><code>EPIPE</code></td>
877     <td>Indicates a broken pipe.</td>
878   </tr>
879   <tr>
880     <td><code>EPROTO</code></td>
881     <td>Indicates a protocol error.</td>
882   </tr>
883   <tr>
884     <td><code>EPROTONOSUPPORT</code></td>
885     <td>Indicates that a protocol is not supported.</td>
886   </tr>
887   <tr>
888     <td><code>EPROTOTYPE</code></td>
889     <td>Indicates the wrong type of protocol for a socket.</td>
890   </tr>
891   <tr>
892     <td><code>ERANGE</code></td>
893     <td>Indicates that the results are too large.</td>
894   </tr>
895   <tr>
896     <td><code>EROFS</code></td>
897     <td>Indicates that the file system is read only.</td>
898   </tr>
899   <tr>
900     <td><code>ESPIPE</code></td>
901     <td>Indicates an invalid seek operation.</td>
902   </tr>
903   <tr>
904     <td><code>ESRCH</code></td>
905     <td>Indicates that there is no such process.</td>
906   </tr>
907   <tr>
908     <td><code>ESTALE</code></td>
909     <td>Indicates that the file handle is stale.</td>
910   </tr>
911   <tr>
912     <td><code>ETIME</code></td>
913     <td>Indicates an expired timer.</td>
914   </tr>
915   <tr>
916     <td><code>ETIMEDOUT</code></td>
917     <td>Indicates that the connection timed out.</td>
918   </tr>
919   <tr>
920     <td><code>ETXTBSY</code></td>
921     <td>Indicates that a text file is busy.</td>
922   </tr>
923   <tr>
924     <td><code>EWOULDBLOCK</code></td>
925     <td>Indicates that the operation would block.</td>
926   </tr>
927   <tr>
928     <td><code>EXDEV</code></td>
929     <td>Indicates an improper link.
930   </tr>
931 </table>
932 
933 #### Windows-specific error constants
934 
935 The following error codes are specific to the Windows operating system.
936 
937 <table>
938   <tr>
939     <th>Constant</th>
940     <th>Description</th>
941   </tr>
942   <tr>
943     <td><code>WSAEINTR</code></td>
944     <td>Indicates an interrupted function call.</td>
945   </tr>
946   <tr>
947     <td><code>WSAEBADF</code></td>
948     <td>Indicates an invalid file handle.</td>
949   </tr>
950   <tr>
951     <td><code>WSAEACCES</code></td>
952     <td>Indicates insufficient permissions to complete the operation.</td>
953   </tr>
954   <tr>
955     <td><code>WSAEFAULT</code></td>
956     <td>Indicates an invalid pointer address.</td>
957   </tr>
958   <tr>
959     <td><code>WSAEINVAL</code></td>
960     <td>Indicates that an invalid argument was passed.</td>
961   </tr>
962   <tr>
963     <td><code>WSAEMFILE</code></td>
964     <td>Indicates that there are too many open files.</td>
965   </tr>
966   <tr>
967     <td><code>WSAEWOULDBLOCK</code></td>
968     <td>Indicates that a resource is temporarily unavailable.</td>
969   </tr>
970   <tr>
971     <td><code>WSAEINPROGRESS</code></td>
972     <td>Indicates that an operation is currently in progress.</td>
973   </tr>
974   <tr>
975     <td><code>WSAEALREADY</code></td>
976     <td>Indicates that an operation is already in progress.</td>
977   </tr>
978   <tr>
979     <td><code>WSAENOTSOCK</code></td>
980     <td>Indicates that the resource is not a socket.</td>
981   </tr>
982   <tr>
983     <td><code>WSAEDESTADDRREQ</code></td>
984     <td>Indicates that a destination address is required.</td>
985   </tr>
986   <tr>
987     <td><code>WSAEMSGSIZE</code></td>
988     <td>Indicates that the message size is too long.</td>
989   </tr>
990   <tr>
991     <td><code>WSAEPROTOTYPE</code></td>
992     <td>Indicates the wrong protocol type for the socket.</td>
993   </tr>
994   <tr>
995     <td><code>WSAENOPROTOOPT</code></td>
996     <td>Indicates a bad protocol option.</td>
997   </tr>
998   <tr>
999     <td><code>WSAEPROTONOSUPPORT</code></td>
1000     <td>Indicates that the protocol is not supported.</td>
1001   </tr>
1002   <tr>
1003     <td><code>WSAESOCKTNOSUPPORT</code></td>
1004     <td>Indicates that the socket type is not supported.</td>
1005   </tr>
1006   <tr>
1007     <td><code>WSAEOPNOTSUPP</code></td>
1008     <td>Indicates that the operation is not supported.</td>
1009   </tr>
1010   <tr>
1011     <td><code>WSAEPFNOSUPPORT</code></td>
1012     <td>Indicates that the protocol family is not supported.</td>
1013   </tr>
1014   <tr>
1015     <td><code>WSAEAFNOSUPPORT</code></td>
1016     <td>Indicates that the address family is not supported.</td>
1017   </tr>
1018   <tr>
1019     <td><code>WSAEADDRINUSE</code></td>
1020     <td>Indicates that the network address is already in use.</td>
1021   </tr>
1022   <tr>
1023     <td><code>WSAEADDRNOTAVAIL</code></td>
1024     <td>Indicates that the network address is not available.</td>
1025   </tr>
1026   <tr>
1027     <td><code>WSAENETDOWN</code></td>
1028     <td>Indicates that the network is down.</td>
1029   </tr>
1030   <tr>
1031     <td><code>WSAENETUNREACH</code></td>
1032     <td>Indicates that the network is unreachable.</td>
1033   </tr>
1034   <tr>
1035     <td><code>WSAENETRESET</code></td>
1036     <td>Indicates that the network connection has been reset.</td>
1037   </tr>
1038   <tr>
1039     <td><code>WSAECONNABORTED</code></td>
1040     <td>Indicates that the connection has been aborted.</td>
1041   </tr>
1042   <tr>
1043     <td><code>WSAECONNRESET</code></td>
1044     <td>Indicates that the connection has been reset by the peer.</td>
1045   </tr>
1046   <tr>
1047     <td><code>WSAENOBUFS</code></td>
1048     <td>Indicates that there is no buffer space available.</td>
1049   </tr>
1050   <tr>
1051     <td><code>WSAEISCONN</code></td>
1052     <td>Indicates that the socket is already connected.</td>
1053   </tr>
1054   <tr>
1055     <td><code>WSAENOTCONN</code></td>
1056     <td>Indicates that the socket is not connected.</td>
1057   </tr>
1058   <tr>
1059     <td><code>WSAESHUTDOWN</code></td>
1060     <td>Indicates that data cannot be sent after the socket has been
1061     shutdown.</td>
1062   </tr>
1063   <tr>
1064     <td><code>WSAETOOMANYREFS</code></td>
1065     <td>Indicates that there are too many references.</td>
1066   </tr>
1067   <tr>
1068     <td><code>WSAETIMEDOUT</code></td>
1069     <td>Indicates that the connection has timed out.</td>
1070   </tr>
1071   <tr>
1072     <td><code>WSAECONNREFUSED</code></td>
1073     <td>Indicates that the connection has been refused.</td>
1074   </tr>
1075   <tr>
1076     <td><code>WSAELOOP</code></td>
1077     <td>Indicates that a name cannot be translated.</td>
1078   </tr>
1079   <tr>
1080     <td><code>WSAENAMETOOLONG</code></td>
1081     <td>Indicates that a name was too long.</td>
1082   </tr>
1083   <tr>
1084     <td><code>WSAEHOSTDOWN</code></td>
1085     <td>Indicates that a network host is down.</td>
1086   </tr>
1087   <tr>
1088     <td><code>WSAEHOSTUNREACH</code></td>
1089     <td>Indicates that there is no route to a network host.</td>
1090   </tr>
1091   <tr>
1092     <td><code>WSAENOTEMPTY</code></td>
1093     <td>Indicates that the directory is not empty.</td>
1094   </tr>
1095   <tr>
1096     <td><code>WSAEPROCLIM</code></td>
1097     <td>Indicates that there are too many processes.</td>
1098   </tr>
1099   <tr>
1100     <td><code>WSAEUSERS</code></td>
1101     <td>Indicates that the user quota has been exceeded.</td>
1102   </tr>
1103   <tr>
1104     <td><code>WSAEDQUOT</code></td>
1105     <td>Indicates that the disk quota has been exceeded.</td>
1106   </tr>
1107   <tr>
1108     <td><code>WSAESTALE</code></td>
1109     <td>Indicates a stale file handle reference.</td>
1110   </tr>
1111   <tr>
1112     <td><code>WSAEREMOTE</code></td>
1113     <td>Indicates that the item is remote.</td>
1114   </tr>
1115   <tr>
1116     <td><code>WSASYSNOTREADY</code></td>
1117     <td>Indicates that the network subsystem is not ready.</td>
1118   </tr>
1119   <tr>
1120     <td><code>WSAVERNOTSUPPORTED</code></td>
1121     <td>Indicates that the <code>winsock.dll</code> version is out of
1122     range.</td>
1123   </tr>
1124   <tr>
1125     <td><code>WSANOTINITIALISED</code></td>
1126     <td>Indicates that successful WSAStartup has not yet been performed.</td>
1127   </tr>
1128   <tr>
1129     <td><code>WSAEDISCON</code></td>
1130     <td>Indicates that a graceful shutdown is in progress.</td>
1131   </tr>
1132   <tr>
1133     <td><code>WSAENOMORE</code></td>
1134     <td>Indicates that there are no more results.</td>
1135   </tr>
1136   <tr>
1137     <td><code>WSAECANCELLED</code></td>
1138     <td>Indicates that an operation has been canceled.</td>
1139   </tr>
1140   <tr>
1141     <td><code>WSAEINVALIDPROCTABLE</code></td>
1142     <td>Indicates that the procedure call table is invalid.</td>
1143   </tr>
1144   <tr>
1145     <td><code>WSAEINVALIDPROVIDER</code></td>
1146     <td>Indicates an invalid service provider.</td>
1147   </tr>
1148   <tr>
1149     <td><code>WSAEPROVIDERFAILEDINIT</code></td>
1150     <td>Indicates that the service provider failed to initialized.</td>
1151   </tr>
1152   <tr>
1153     <td><code>WSASYSCALLFAILURE</code></td>
1154     <td>Indicates a system call failure.</td>
1155   </tr>
1156   <tr>
1157     <td><code>WSASERVICE_NOT_FOUND</code></td>
1158     <td>Indicates that a service was not found.</td>
1159   </tr>
1160   <tr>
1161     <td><code>WSATYPE_NOT_FOUND</code></td>
1162     <td>Indicates that a class type was not found.</td>
1163   </tr>
1164   <tr>
1165     <td><code>WSA_E_NO_MORE</code></td>
1166     <td>Indicates that there are no more results.</td>
1167   </tr>
1168   <tr>
1169     <td><code>WSA_E_CANCELLED</code></td>
1170     <td>Indicates that the call was canceled.</td>
1171   </tr>
1172   <tr>
1173     <td><code>WSAEREFUSED</code></td>
1174     <td>Indicates that a database query was refused.</td>
1175   </tr>
1176 </table>
1177 
1178 ### dlopen constants
1179 
1180 If available on the operating system, the following constants
1181 are exported in `os.constants.dlopen`. See dlopen(3) for detailed
1182 information.
1183 
1184 <table>
1185   <tr>
1186     <th>Constant</th>
1187     <th>Description</th>
1188   </tr>
1189   <tr>
1190     <td><code>RTLD_LAZY</code></td>
1191     <td>Perform lazy binding. Node.js sets this flag by default.</td>
1192   </tr>
1193   <tr>
1194     <td><code>RTLD_NOW</code></td>
1195     <td>Resolve all undefined symbols in the library before dlopen(3)
1196     returns.</td>
1197   </tr>
1198   <tr>
1199     <td><code>RTLD_GLOBAL</code></td>
1200     <td>Symbols defined by the library will be made available for symbol
1201     resolution of subsequently loaded libraries.</td>
1202   </tr>
1203   <tr>
1204     <td><code>RTLD_LOCAL</code></td>
1205     <td>The converse of <code>RTLD_GLOBAL</code>. This is the default behavior
1206     if neither flag is specified.</td>
1207   </tr>
1208   <tr>
1209     <td><code>RTLD_DEEPBIND</code></td>
1210     <td>Make a self-contained library use its own symbols in preference to
1211     symbols from previously loaded libraries.</td>
1212   </tr>
1213 </table>
1214 
1215 ### Priority constants
1216 <!-- YAML
1217 added: v10.10.0
1218 -->
1219 
1220 The following process scheduling constants are exported by
1221 `os.constants.priority`.
1222 
1223 <table>
1224   <tr>
1225     <th>Constant</th>
1226     <th>Description</th>
1227   </tr>
1228   <tr>
1229     <td><code>PRIORITY_LOW</code></td>
1230     <td>The lowest process scheduling priority. This corresponds to
1231     <code>IDLE_PRIORITY_CLASS</code> on Windows, and a nice value of
1232     <code>19</code> on all other platforms.</td>
1233   </tr>
1234   <tr>
1235     <td><code>PRIORITY_BELOW_NORMAL</code></td>
1236     <td>The process scheduling priority above <code>PRIORITY_LOW</code> and
1237     below <code>PRIORITY_NORMAL</code>. This corresponds to
1238     <code>BELOW_NORMAL_PRIORITY_CLASS</code> on Windows, and a nice value of
1239     <code>10</code> on all other platforms.</td>
1240   </tr>
1241   <tr>
1242     <td><code>PRIORITY_NORMAL</code></td>
1243     <td>The default process scheduling priority. This corresponds to
1244     <code>NORMAL_PRIORITY_CLASS</code> on Windows, and a nice value of
1245     <code>0</code> on all other platforms.</td>
1246   </tr>
1247   <tr>
1248     <td><code>PRIORITY_ABOVE_NORMAL</code></td>
1249     <td>The process scheduling priority above <code>PRIORITY_NORMAL</code> and
1250     below <code>PRIORITY_HIGH</code>. This corresponds to
1251     <code>ABOVE_NORMAL_PRIORITY_CLASS</code> on Windows, and a nice value of
1252     <code>-7</code> on all other platforms.</td>
1253   </tr>
1254   <tr>
1255     <td><code>PRIORITY_HIGH</code></td>
1256     <td>The process scheduling priority above <code>PRIORITY_ABOVE_NORMAL</code>
1257     and below <code>PRIORITY_HIGHEST</code>. This corresponds to
1258     <code>HIGH_PRIORITY_CLASS</code> on Windows, and a nice value of
1259     <code>-14</code> on all other platforms.</td>
1260   </tr>
1261   <tr>
1262     <td><code>PRIORITY_HIGHEST</code></td>
1263     <td>The highest process scheduling priority. This corresponds to
1264     <code>REALTIME_PRIORITY_CLASS</code> on Windows, and a nice value of
1265     <code>-20</code> on all other platforms.</td>
1266   </tr>
1267 </table>
1268 
1269 ### libuv constants
1270 
1271 <table>
1272   <tr>
1273     <th>Constant</th>
1274     <th>Description</th>
1275   </tr>
1276   <tr>
1277     <td><code>UV_UDP_REUSEADDR</code></td>
1278     <td></td>
1279   </tr>
1280 </table>
1281 
1282 [Android building]: https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os
1283 [EUID]: https://en.wikipedia.org/wiki/User_identifier#Effective_user_ID
1284 [`SystemError`]: errors.md#errors_class_systemerror
1285 [`process.arch`]: process.md#process_process_arch
1286 [`process.platform`]: process.md#process_process_platform
1287 [`uname(3)`]: https://linux.die.net/man/3/uname
1288