xref: /third_party/node/doc/api/os.html (revision 1cb0ef41)
1<!DOCTYPE html>
2<html lang="en">
3<head>
4  <meta charset="utf-8">
5  <meta name="viewport" content="width=device-width">
6  <meta name="nodejs.org:node-version" content="v18.20.1">
7  <title>OS | Node.js v18.20.1 Documentation</title>
8  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic&display=fallback">
9  <link rel="stylesheet" href="assets/style.css">
10  <link rel="stylesheet" href="assets/hljs.css">
11  <link rel="canonical" href="https://nodejs.org/api/os.html">
12  <script async defer src="assets/api.js" type="text/javascript"></script>
13  
14</head>
15<body class="alt apidoc" id="api-section-os">
16  <div id="content" class="clearfix">
17    <div id="column2" class="interior">
18      <div id="intro" class="interior">
19        <a href="/" title="Go back to the home page">
20          Node.js
21        </a>
22      </div>
23      <ul>
24<li><a href="documentation.html" class="nav-documentation">About this documentation</a></li>
25<li><a href="synopsis.html" class="nav-synopsis">Usage and example</a></li>
26</ul>
27<hr class="line">
28<ul>
29<li><a href="assert.html" class="nav-assert">Assertion testing</a></li>
30<li><a href="async_context.html" class="nav-async_context">Asynchronous context tracking</a></li>
31<li><a href="async_hooks.html" class="nav-async_hooks">Async hooks</a></li>
32<li><a href="buffer.html" class="nav-buffer">Buffer</a></li>
33<li><a href="addons.html" class="nav-addons">C++ addons</a></li>
34<li><a href="n-api.html" class="nav-n-api">C/C++ addons with Node-API</a></li>
35<li><a href="embedding.html" class="nav-embedding">C++ embedder API</a></li>
36<li><a href="child_process.html" class="nav-child_process">Child processes</a></li>
37<li><a href="cluster.html" class="nav-cluster">Cluster</a></li>
38<li><a href="cli.html" class="nav-cli">Command-line options</a></li>
39<li><a href="console.html" class="nav-console">Console</a></li>
40<li><a href="corepack.html" class="nav-corepack">Corepack</a></li>
41<li><a href="crypto.html" class="nav-crypto">Crypto</a></li>
42<li><a href="debugger.html" class="nav-debugger">Debugger</a></li>
43<li><a href="deprecations.html" class="nav-deprecations">Deprecated APIs</a></li>
44<li><a href="diagnostics_channel.html" class="nav-diagnostics_channel">Diagnostics Channel</a></li>
45<li><a href="dns.html" class="nav-dns">DNS</a></li>
46<li><a href="domain.html" class="nav-domain">Domain</a></li>
47<li><a href="errors.html" class="nav-errors">Errors</a></li>
48<li><a href="events.html" class="nav-events">Events</a></li>
49<li><a href="fs.html" class="nav-fs">File system</a></li>
50<li><a href="globals.html" class="nav-globals">Globals</a></li>
51<li><a href="http.html" class="nav-http">HTTP</a></li>
52<li><a href="http2.html" class="nav-http2">HTTP/2</a></li>
53<li><a href="https.html" class="nav-https">HTTPS</a></li>
54<li><a href="inspector.html" class="nav-inspector">Inspector</a></li>
55<li><a href="intl.html" class="nav-intl">Internationalization</a></li>
56<li><a href="modules.html" class="nav-modules">Modules: CommonJS modules</a></li>
57<li><a href="esm.html" class="nav-esm">Modules: ECMAScript modules</a></li>
58<li><a href="module.html" class="nav-module">Modules: <code>node:module</code> API</a></li>
59<li><a href="packages.html" class="nav-packages">Modules: Packages</a></li>
60<li><a href="net.html" class="nav-net">Net</a></li>
61<li><a href="os.html" class="nav-os active">OS</a></li>
62<li><a href="path.html" class="nav-path">Path</a></li>
63<li><a href="perf_hooks.html" class="nav-perf_hooks">Performance hooks</a></li>
64<li><a href="permissions.html" class="nav-permissions">Permissions</a></li>
65<li><a href="process.html" class="nav-process">Process</a></li>
66<li><a href="punycode.html" class="nav-punycode">Punycode</a></li>
67<li><a href="querystring.html" class="nav-querystring">Query strings</a></li>
68<li><a href="readline.html" class="nav-readline">Readline</a></li>
69<li><a href="repl.html" class="nav-repl">REPL</a></li>
70<li><a href="report.html" class="nav-report">Report</a></li>
71<li><a href="single-executable-applications.html" class="nav-single-executable-applications">Single executable applications</a></li>
72<li><a href="stream.html" class="nav-stream">Stream</a></li>
73<li><a href="string_decoder.html" class="nav-string_decoder">String decoder</a></li>
74<li><a href="test.html" class="nav-test">Test runner</a></li>
75<li><a href="timers.html" class="nav-timers">Timers</a></li>
76<li><a href="tls.html" class="nav-tls">TLS/SSL</a></li>
77<li><a href="tracing.html" class="nav-tracing">Trace events</a></li>
78<li><a href="tty.html" class="nav-tty">TTY</a></li>
79<li><a href="dgram.html" class="nav-dgram">UDP/datagram</a></li>
80<li><a href="url.html" class="nav-url">URL</a></li>
81<li><a href="util.html" class="nav-util">Utilities</a></li>
82<li><a href="v8.html" class="nav-v8">V8</a></li>
83<li><a href="vm.html" class="nav-vm">VM</a></li>
84<li><a href="wasi.html" class="nav-wasi">WASI</a></li>
85<li><a href="webcrypto.html" class="nav-webcrypto">Web Crypto API</a></li>
86<li><a href="webstreams.html" class="nav-webstreams">Web Streams API</a></li>
87<li><a href="worker_threads.html" class="nav-worker_threads">Worker threads</a></li>
88<li><a href="zlib.html" class="nav-zlib">Zlib</a></li>
89</ul>
90<hr class="line">
91<ul>
92<li><a href="https://github.com/nodejs/node" class="nav-https-github-com-nodejs-node">Code repository and issue tracker</a></li>
93</ul>
94    </div>
95
96    <div id="column1" data-id="os" class="interior">
97      <header class="header">
98        <div class="header-container">
99          <h1>Node.js v18.20.1 documentation</h1>
100          <button class="theme-toggle-btn" id="theme-toggle-btn" title="Toggle dark mode/light mode" aria-label="Toggle dark mode/light mode" hidden>
101            <svg xmlns="http://www.w3.org/2000/svg" class="icon dark-icon" height="24" width="24">
102              <path fill="none" d="M0 0h24v24H0z" />
103              <path d="M11.1 12.08c-2.33-4.51-.5-8.48.53-10.07C6.27 2.2 1.98 6.59 1.98 12c0 .14.02.28.02.42.62-.27 1.29-.42 2-.42 1.66 0 3.18.83 4.1 2.15A4.01 4.01 0 0111 18c0 1.52-.87 2.83-2.12 3.51.98.32 2.03.5 3.11.5 3.5 0 6.58-1.8 8.37-4.52-2.36.23-6.98-.97-9.26-5.41z"/>
104              <path d="M7 16h-.18C6.4 14.84 5.3 14 4 14c-1.66 0-3 1.34-3 3s1.34 3 3 3h3c1.1 0 2-.9 2-2s-.9-2-2-2z"/>
105            </svg>
106            <svg xmlns="http://www.w3.org/2000/svg" class="icon light-icon" height="24" width="24">
107              <path d="M0 0h24v24H0z" fill="none" />
108              <path d="M6.76 4.84l-1.8-1.79-1.41 1.41 1.79 1.79 1.42-1.41zM4 10.5H1v2h3v-2zm9-9.95h-2V3.5h2V.55zm7.45 3.91l-1.41-1.41-1.79 1.79 1.41 1.41 1.79-1.79zm-3.21 13.7l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4zM20 10.5v2h3v-2h-3zm-8-5c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm-1 16.95h2V19.5h-2v2.95zm-7.45-3.91l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8z"/>
109            </svg>
110          </button>
111        </div>
112        <div id="gtoc">
113          <ul>
114            <li class="pinned-header">Node.js v18.20.1</li>
115            
116    <li class="picker-header">
117      <a href="#">
118        <span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
119        Table of contents
120      </a>
121
122      <div class="picker"><div class="toc"><ul>
123<li><span class="stability_2"><a href="#os">OS</a></span>
124<ul>
125<li><a href="#oseol"><code>os.EOL</code></a></li>
126<li><a href="#osavailableparallelism"><code>os.availableParallelism()</code></a></li>
127<li><a href="#osarch"><code>os.arch()</code></a></li>
128<li><a href="#osconstants"><code>os.constants</code></a></li>
129<li><a href="#oscpus"><code>os.cpus()</code></a></li>
130<li><a href="#osdevnull"><code>os.devNull</code></a></li>
131<li><a href="#osendianness"><code>os.endianness()</code></a></li>
132<li><a href="#osfreemem"><code>os.freemem()</code></a></li>
133<li><a href="#osgetprioritypid"><code>os.getPriority([pid])</code></a></li>
134<li><a href="#oshomedir"><code>os.homedir()</code></a></li>
135<li><a href="#oshostname"><code>os.hostname()</code></a></li>
136<li><a href="#osloadavg"><code>os.loadavg()</code></a></li>
137<li><a href="#osmachine"><code>os.machine()</code></a></li>
138<li><a href="#osnetworkinterfaces"><code>os.networkInterfaces()</code></a></li>
139<li><a href="#osplatform"><code>os.platform()</code></a></li>
140<li><a href="#osrelease"><code>os.release()</code></a></li>
141<li><a href="#ossetprioritypid-priority"><code>os.setPriority([pid, ]priority)</code></a></li>
142<li><a href="#ostmpdir"><code>os.tmpdir()</code></a></li>
143<li><a href="#ostotalmem"><code>os.totalmem()</code></a></li>
144<li><a href="#ostype"><code>os.type()</code></a></li>
145<li><a href="#osuptime"><code>os.uptime()</code></a></li>
146<li><a href="#osuserinfooptions"><code>os.userInfo([options])</code></a></li>
147<li><a href="#osversion"><code>os.version()</code></a></li>
148<li><a href="#os-constants">OS constants</a>
149<ul>
150<li><a href="#signal-constants">Signal constants</a></li>
151<li><a href="#error-constants">Error constants</a>
152<ul>
153<li><a href="#posix-error-constants">POSIX error constants</a></li>
154<li><a href="#windows-specific-error-constants">Windows-specific error constants</a></li>
155</ul>
156</li>
157<li><a href="#dlopen-constants">dlopen constants</a></li>
158<li><a href="#priority-constants">Priority constants</a></li>
159<li><a href="#libuv-constants">libuv constants</a></li>
160</ul>
161</li>
162</ul>
163</li>
164</ul></div></div>
165    </li>
166  
167            
168    <li class="picker-header">
169      <a href="#">
170        <span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
171        Index
172      </a>
173
174      <div class="picker"><ul>
175<li><a href="documentation.html" class="nav-documentation">About this documentation</a></li>
176<li><a href="synopsis.html" class="nav-synopsis">Usage and example</a></li>
177
178      <li>
179        <a href="index.html">Index</a>
180      </li>
181    </ul>
182  
183<hr class="line">
184<ul>
185<li><a href="assert.html" class="nav-assert">Assertion testing</a></li>
186<li><a href="async_context.html" class="nav-async_context">Asynchronous context tracking</a></li>
187<li><a href="async_hooks.html" class="nav-async_hooks">Async hooks</a></li>
188<li><a href="buffer.html" class="nav-buffer">Buffer</a></li>
189<li><a href="addons.html" class="nav-addons">C++ addons</a></li>
190<li><a href="n-api.html" class="nav-n-api">C/C++ addons with Node-API</a></li>
191<li><a href="embedding.html" class="nav-embedding">C++ embedder API</a></li>
192<li><a href="child_process.html" class="nav-child_process">Child processes</a></li>
193<li><a href="cluster.html" class="nav-cluster">Cluster</a></li>
194<li><a href="cli.html" class="nav-cli">Command-line options</a></li>
195<li><a href="console.html" class="nav-console">Console</a></li>
196<li><a href="corepack.html" class="nav-corepack">Corepack</a></li>
197<li><a href="crypto.html" class="nav-crypto">Crypto</a></li>
198<li><a href="debugger.html" class="nav-debugger">Debugger</a></li>
199<li><a href="deprecations.html" class="nav-deprecations">Deprecated APIs</a></li>
200<li><a href="diagnostics_channel.html" class="nav-diagnostics_channel">Diagnostics Channel</a></li>
201<li><a href="dns.html" class="nav-dns">DNS</a></li>
202<li><a href="domain.html" class="nav-domain">Domain</a></li>
203<li><a href="errors.html" class="nav-errors">Errors</a></li>
204<li><a href="events.html" class="nav-events">Events</a></li>
205<li><a href="fs.html" class="nav-fs">File system</a></li>
206<li><a href="globals.html" class="nav-globals">Globals</a></li>
207<li><a href="http.html" class="nav-http">HTTP</a></li>
208<li><a href="http2.html" class="nav-http2">HTTP/2</a></li>
209<li><a href="https.html" class="nav-https">HTTPS</a></li>
210<li><a href="inspector.html" class="nav-inspector">Inspector</a></li>
211<li><a href="intl.html" class="nav-intl">Internationalization</a></li>
212<li><a href="modules.html" class="nav-modules">Modules: CommonJS modules</a></li>
213<li><a href="esm.html" class="nav-esm">Modules: ECMAScript modules</a></li>
214<li><a href="module.html" class="nav-module">Modules: <code>node:module</code> API</a></li>
215<li><a href="packages.html" class="nav-packages">Modules: Packages</a></li>
216<li><a href="net.html" class="nav-net">Net</a></li>
217<li><a href="os.html" class="nav-os active">OS</a></li>
218<li><a href="path.html" class="nav-path">Path</a></li>
219<li><a href="perf_hooks.html" class="nav-perf_hooks">Performance hooks</a></li>
220<li><a href="permissions.html" class="nav-permissions">Permissions</a></li>
221<li><a href="process.html" class="nav-process">Process</a></li>
222<li><a href="punycode.html" class="nav-punycode">Punycode</a></li>
223<li><a href="querystring.html" class="nav-querystring">Query strings</a></li>
224<li><a href="readline.html" class="nav-readline">Readline</a></li>
225<li><a href="repl.html" class="nav-repl">REPL</a></li>
226<li><a href="report.html" class="nav-report">Report</a></li>
227<li><a href="single-executable-applications.html" class="nav-single-executable-applications">Single executable applications</a></li>
228<li><a href="stream.html" class="nav-stream">Stream</a></li>
229<li><a href="string_decoder.html" class="nav-string_decoder">String decoder</a></li>
230<li><a href="test.html" class="nav-test">Test runner</a></li>
231<li><a href="timers.html" class="nav-timers">Timers</a></li>
232<li><a href="tls.html" class="nav-tls">TLS/SSL</a></li>
233<li><a href="tracing.html" class="nav-tracing">Trace events</a></li>
234<li><a href="tty.html" class="nav-tty">TTY</a></li>
235<li><a href="dgram.html" class="nav-dgram">UDP/datagram</a></li>
236<li><a href="url.html" class="nav-url">URL</a></li>
237<li><a href="util.html" class="nav-util">Utilities</a></li>
238<li><a href="v8.html" class="nav-v8">V8</a></li>
239<li><a href="vm.html" class="nav-vm">VM</a></li>
240<li><a href="wasi.html" class="nav-wasi">WASI</a></li>
241<li><a href="webcrypto.html" class="nav-webcrypto">Web Crypto API</a></li>
242<li><a href="webstreams.html" class="nav-webstreams">Web Streams API</a></li>
243<li><a href="worker_threads.html" class="nav-worker_threads">Worker threads</a></li>
244<li><a href="zlib.html" class="nav-zlib">Zlib</a></li>
245</ul>
246<hr class="line">
247<ul>
248<li><a href="https://github.com/nodejs/node" class="nav-https-github-com-nodejs-node">Code repository and issue tracker</a></li>
249</ul></div>
250    </li>
251  
252            
253    <li class="picker-header">
254      <a href="#">
255        <span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
256        Other versions
257      </a>
258      <div class="picker"><ol id="alt-docs"><li><a href="https://nodejs.org/docs/latest-v21.x/api/os.html">21.x</a></li>
259<li><a href="https://nodejs.org/docs/latest-v20.x/api/os.html">20.x <b>LTS</b></a></li>
260<li><a href="https://nodejs.org/docs/latest-v19.x/api/os.html">19.x</a></li>
261<li><a href="https://nodejs.org/docs/latest-v18.x/api/os.html">18.x <b>LTS</b></a></li>
262<li><a href="https://nodejs.org/docs/latest-v17.x/api/os.html">17.x</a></li>
263<li><a href="https://nodejs.org/docs/latest-v16.x/api/os.html">16.x</a></li>
264<li><a href="https://nodejs.org/docs/latest-v15.x/api/os.html">15.x</a></li>
265<li><a href="https://nodejs.org/docs/latest-v14.x/api/os.html">14.x</a></li>
266<li><a href="https://nodejs.org/docs/latest-v13.x/api/os.html">13.x</a></li>
267<li><a href="https://nodejs.org/docs/latest-v12.x/api/os.html">12.x</a></li>
268<li><a href="https://nodejs.org/docs/latest-v11.x/api/os.html">11.x</a></li>
269<li><a href="https://nodejs.org/docs/latest-v10.x/api/os.html">10.x</a></li>
270<li><a href="https://nodejs.org/docs/latest-v9.x/api/os.html">9.x</a></li>
271<li><a href="https://nodejs.org/docs/latest-v8.x/api/os.html">8.x</a></li>
272<li><a href="https://nodejs.org/docs/latest-v7.x/api/os.html">7.x</a></li>
273<li><a href="https://nodejs.org/docs/latest-v6.x/api/os.html">6.x</a></li>
274<li><a href="https://nodejs.org/docs/latest-v5.x/api/os.html">5.x</a></li>
275<li><a href="https://nodejs.org/docs/latest-v4.x/api/os.html">4.x</a></li>
276<li><a href="https://nodejs.org/docs/latest-v0.12.x/api/os.html">0.12.x</a></li>
277<li><a href="https://nodejs.org/docs/latest-v0.10.x/api/os.html">0.10.x</a></li></ol></div>
278    </li>
279  
280            <li class="picker-header">
281              <a href="#">
282                <span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
283                Options
284              </a>
285        
286              <div class="picker">
287                <ul>
288                  <li>
289                    <a href="all.html">View on single page</a>
290                  </li>
291                  <li>
292                    <a href="os.json">View as JSON</a>
293                  </li>
294                  <li class="edit_on_github"><a href="https://github.com/nodejs/node/edit/main/doc/api/os.md">Edit on GitHub</a></li>    
295                </ul>
296              </div>
297            </li>
298          </ul>
299        </div>
300        <hr>
301      </header>
302
303      <details id="toc" open><summary>Table of contents</summary><ul>
304<li><span class="stability_2"><a href="#os">OS</a></span>
305<ul>
306<li><a href="#oseol"><code>os.EOL</code></a></li>
307<li><a href="#osavailableparallelism"><code>os.availableParallelism()</code></a></li>
308<li><a href="#osarch"><code>os.arch()</code></a></li>
309<li><a href="#osconstants"><code>os.constants</code></a></li>
310<li><a href="#oscpus"><code>os.cpus()</code></a></li>
311<li><a href="#osdevnull"><code>os.devNull</code></a></li>
312<li><a href="#osendianness"><code>os.endianness()</code></a></li>
313<li><a href="#osfreemem"><code>os.freemem()</code></a></li>
314<li><a href="#osgetprioritypid"><code>os.getPriority([pid])</code></a></li>
315<li><a href="#oshomedir"><code>os.homedir()</code></a></li>
316<li><a href="#oshostname"><code>os.hostname()</code></a></li>
317<li><a href="#osloadavg"><code>os.loadavg()</code></a></li>
318<li><a href="#osmachine"><code>os.machine()</code></a></li>
319<li><a href="#osnetworkinterfaces"><code>os.networkInterfaces()</code></a></li>
320<li><a href="#osplatform"><code>os.platform()</code></a></li>
321<li><a href="#osrelease"><code>os.release()</code></a></li>
322<li><a href="#ossetprioritypid-priority"><code>os.setPriority([pid, ]priority)</code></a></li>
323<li><a href="#ostmpdir"><code>os.tmpdir()</code></a></li>
324<li><a href="#ostotalmem"><code>os.totalmem()</code></a></li>
325<li><a href="#ostype"><code>os.type()</code></a></li>
326<li><a href="#osuptime"><code>os.uptime()</code></a></li>
327<li><a href="#osuserinfooptions"><code>os.userInfo([options])</code></a></li>
328<li><a href="#osversion"><code>os.version()</code></a></li>
329<li><a href="#os-constants">OS constants</a>
330<ul>
331<li><a href="#signal-constants">Signal constants</a></li>
332<li><a href="#error-constants">Error constants</a>
333<ul>
334<li><a href="#posix-error-constants">POSIX error constants</a></li>
335<li><a href="#windows-specific-error-constants">Windows-specific error constants</a></li>
336</ul>
337</li>
338<li><a href="#dlopen-constants">dlopen constants</a></li>
339<li><a href="#priority-constants">Priority constants</a></li>
340<li><a href="#libuv-constants">libuv constants</a></li>
341</ul>
342</li>
343</ul>
344</li>
345</ul></details>
346
347      <div id="apicontent">
348        <h2>OS<span><a class="mark" href="#os" id="os">#</a></span><a aria-hidden="true" class="legacy" id="os_os"></a></h2>
349
350<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable</div><p></p>
351<p><strong>Source Code:</strong> <a href="https://github.com/nodejs/node/blob/v18.20.1/lib/os.js">lib/os.js</a></p>
352<p>The <code>node:os</code> module provides operating system-related utility methods and
353properties. It can be accessed using:</p>
354<pre><code class="language-js"><span class="hljs-keyword">const</span> os = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:os'</span>);</code> <button class="copy-button">copy</button></pre>
355<section><h3><code>os.EOL</code><span><a class="mark" href="#oseol" id="oseol">#</a></span><a aria-hidden="true" class="legacy" id="os_os_eol"></a></h3>
356<div class="api_metadata">
357<span>Added in: v0.7.8</span>
358</div>
359<ul>
360<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
361</ul>
362<p>The operating system-specific end-of-line marker.</p>
363<ul>
364<li><code>\n</code> on POSIX</li>
365<li><code>\r\n</code> on Windows</li>
366</ul>
367</section><section><h3><code>os.availableParallelism()</code><span><a class="mark" href="#osavailableparallelism" id="osavailableparallelism">#</a></span><a aria-hidden="true" class="legacy" id="os_os_availableparallelism"></a></h3>
368<div class="api_metadata">
369<span>Added in: v18.14.0</span>
370</div>
371<ul>
372<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;integer></a></li>
373</ul>
374<p>Returns an estimate of the default amount of parallelism a program should use.
375Always returns a value greater than zero.</p>
376<p>This function is a small wrapper about libuv's <a href="https://docs.libuv.org/en/v1.x/misc.html#c.uv_available_parallelism"><code>uv_available_parallelism()</code></a>.</p>
377</section><section><h3><code>os.arch()</code><span><a class="mark" href="#osarch" id="osarch">#</a></span><a aria-hidden="true" class="legacy" id="os_os_arch"></a></h3>
378<div class="api_metadata">
379<span>Added in: v0.5.0</span>
380</div>
381<ul>
382<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
383</ul>
384<p>Returns the operating system CPU architecture for which the Node.js binary was
385compiled. Possible values are <code>'arm'</code>, <code>'arm64'</code>, <code>'ia32'</code>, <code>'mips'</code>,
386<code>'mipsel'</code>, <code>'ppc'</code>, <code>'ppc64'</code>, <code>'s390'</code>, <code>'s390x'</code>, and <code>'x64'</code>.</p>
387<p>The return value is equivalent to <a href="process.html#processarch"><code>process.arch</code></a>.</p>
388</section><section><h3><code>os.constants</code><span><a class="mark" href="#osconstants" id="osconstants">#</a></span><a aria-hidden="true" class="legacy" id="os_os_constants"></a></h3>
389<div class="api_metadata">
390<span>Added in: v6.3.0</span>
391</div>
392<ul>
393<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
394</ul>
395<p>Contains commonly used operating system-specific constants for error codes,
396process signals, and so on. The specific constants defined are described in
397<a href="#os-constants">OS constants</a>.</p>
398</section><section><h3><code>os.cpus()</code><span><a class="mark" href="#oscpus" id="oscpus">#</a></span><a aria-hidden="true" class="legacy" id="os_os_cpus"></a></h3>
399<div class="api_metadata">
400<span>Added in: v0.3.3</span>
401</div>
402<ul>
403<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object[]></a></li>
404</ul>
405<p>Returns an array of objects containing information about each logical CPU core.
406The array will be empty if no CPU information is available, such as if the
407<code>/proc</code> file system is unavailable.</p>
408<p>The properties included on each object include:</p>
409<ul>
410<li><code>model</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
411<li><code>speed</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a> (in MHz)</li>
412<li><code>times</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>
413<ul>
414<li><code>user</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a> The number of milliseconds the CPU has spent in user mode.</li>
415<li><code>nice</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a> The number of milliseconds the CPU has spent in nice mode.</li>
416<li><code>sys</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a> The number of milliseconds the CPU has spent in sys mode.</li>
417<li><code>idle</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a> The number of milliseconds the CPU has spent in idle mode.</li>
418<li><code>irq</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a> The number of milliseconds the CPU has spent in irq mode.</li>
419</ul>
420</li>
421</ul>
422<!-- eslint-disable semi -->
423<pre><code class="language-js">[
424  {
425    <span class="hljs-attr">model</span>: <span class="hljs-string">'Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz'</span>,
426    <span class="hljs-attr">speed</span>: <span class="hljs-number">2926</span>,
427    <span class="hljs-attr">times</span>: {
428      <span class="hljs-attr">user</span>: <span class="hljs-number">252020</span>,
429      <span class="hljs-attr">nice</span>: <span class="hljs-number">0</span>,
430      <span class="hljs-attr">sys</span>: <span class="hljs-number">30340</span>,
431      <span class="hljs-attr">idle</span>: <span class="hljs-number">1070356870</span>,
432      <span class="hljs-attr">irq</span>: <span class="hljs-number">0</span>,
433    },
434  },
435  {
436    <span class="hljs-attr">model</span>: <span class="hljs-string">'Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz'</span>,
437    <span class="hljs-attr">speed</span>: <span class="hljs-number">2926</span>,
438    <span class="hljs-attr">times</span>: {
439      <span class="hljs-attr">user</span>: <span class="hljs-number">306960</span>,
440      <span class="hljs-attr">nice</span>: <span class="hljs-number">0</span>,
441      <span class="hljs-attr">sys</span>: <span class="hljs-number">26980</span>,
442      <span class="hljs-attr">idle</span>: <span class="hljs-number">1071569080</span>,
443      <span class="hljs-attr">irq</span>: <span class="hljs-number">0</span>,
444    },
445  },
446  {
447    <span class="hljs-attr">model</span>: <span class="hljs-string">'Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz'</span>,
448    <span class="hljs-attr">speed</span>: <span class="hljs-number">2926</span>,
449    <span class="hljs-attr">times</span>: {
450      <span class="hljs-attr">user</span>: <span class="hljs-number">248450</span>,
451      <span class="hljs-attr">nice</span>: <span class="hljs-number">0</span>,
452      <span class="hljs-attr">sys</span>: <span class="hljs-number">21750</span>,
453      <span class="hljs-attr">idle</span>: <span class="hljs-number">1070919370</span>,
454      <span class="hljs-attr">irq</span>: <span class="hljs-number">0</span>,
455    },
456  },
457  {
458    <span class="hljs-attr">model</span>: <span class="hljs-string">'Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz'</span>,
459    <span class="hljs-attr">speed</span>: <span class="hljs-number">2926</span>,
460    <span class="hljs-attr">times</span>: {
461      <span class="hljs-attr">user</span>: <span class="hljs-number">256880</span>,
462      <span class="hljs-attr">nice</span>: <span class="hljs-number">0</span>,
463      <span class="hljs-attr">sys</span>: <span class="hljs-number">19430</span>,
464      <span class="hljs-attr">idle</span>: <span class="hljs-number">1070905480</span>,
465      <span class="hljs-attr">irq</span>: <span class="hljs-number">20</span>,
466    },
467  },
468]</code> <button class="copy-button">copy</button></pre>
469<p><code>nice</code> values are POSIX-only. On Windows, the <code>nice</code> values of all processors
470are always 0.</p>
471<p><code>os.cpus().length</code> should not be used to calculate the amount of parallelism
472available to an application. Use
473<a href="#osavailableparallelism"><code>os.availableParallelism()</code></a> for this purpose.</p>
474</section><section><h3><code>os.devNull</code><span><a class="mark" href="#osdevnull" id="osdevnull">#</a></span><a aria-hidden="true" class="legacy" id="os_os_devnull"></a></h3>
475<div class="api_metadata">
476<span>Added in: v16.3.0, v14.18.0</span>
477</div>
478<ul>
479<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
480</ul>
481<p>The platform-specific file path of the null device.</p>
482<ul>
483<li><code>\\.\nul</code> on Windows</li>
484<li><code>/dev/null</code> on POSIX</li>
485</ul>
486</section><section><h3><code>os.endianness()</code><span><a class="mark" href="#osendianness" id="osendianness">#</a></span><a aria-hidden="true" class="legacy" id="os_os_endianness"></a></h3>
487<div class="api_metadata">
488<span>Added in: v0.9.4</span>
489</div>
490<ul>
491<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
492</ul>
493<p>Returns a string identifying the endianness of the CPU for which the Node.js
494binary was compiled.</p>
495<p>Possible values are <code>'BE'</code> for big endian and <code>'LE'</code> for little endian.</p>
496</section><section><h3><code>os.freemem()</code><span><a class="mark" href="#osfreemem" id="osfreemem">#</a></span><a aria-hidden="true" class="legacy" id="os_os_freemem"></a></h3>
497<div class="api_metadata">
498<span>Added in: v0.3.3</span>
499</div>
500<ul>
501<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;integer></a></li>
502</ul>
503<p>Returns the amount of free system memory in bytes as an integer.</p>
504</section><section><h3><code>os.getPriority([pid])</code><span><a class="mark" href="#osgetprioritypid" id="osgetprioritypid">#</a></span><a aria-hidden="true" class="legacy" id="os_os_getpriority_pid"></a></h3>
505<div class="api_metadata">
506<span>Added in: v10.10.0</span>
507</div>
508<ul>
509<li><code>pid</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;integer></a> The process ID to retrieve scheduling priority for.
510<strong>Default:</strong> <code>0</code>.</li>
511<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;integer></a></li>
512</ul>
513<p>Returns the scheduling priority for the process specified by <code>pid</code>. If <code>pid</code> is
514not provided or is <code>0</code>, the priority of the current process is returned.</p>
515</section><section><h3><code>os.homedir()</code><span><a class="mark" href="#oshomedir" id="oshomedir">#</a></span><a aria-hidden="true" class="legacy" id="os_os_homedir"></a></h3>
516<div class="api_metadata">
517<span>Added in: v2.3.0</span>
518</div>
519<ul>
520<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
521</ul>
522<p>Returns the string path of the current user's home directory.</p>
523<p>On POSIX, it uses the <code>$HOME</code> environment variable if defined. Otherwise it
524uses the <a href="https://en.wikipedia.org/wiki/User_identifier#Effective_user_ID">effective UID</a> to look up the user's home directory.</p>
525<p>On Windows, it uses the <code>USERPROFILE</code> environment variable if defined.
526Otherwise it uses the path to the profile directory of the current user.</p>
527</section><section><h3><code>os.hostname()</code><span><a class="mark" href="#oshostname" id="oshostname">#</a></span><a aria-hidden="true" class="legacy" id="os_os_hostname"></a></h3>
528<div class="api_metadata">
529<span>Added in: v0.3.3</span>
530</div>
531<ul>
532<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
533</ul>
534<p>Returns the host name of the operating system as a string.</p>
535</section><section><h3><code>os.loadavg()</code><span><a class="mark" href="#osloadavg" id="osloadavg">#</a></span><a aria-hidden="true" class="legacy" id="os_os_loadavg"></a></h3>
536<div class="api_metadata">
537<span>Added in: v0.3.3</span>
538</div>
539<ul>
540<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number[]></a></li>
541</ul>
542<p>Returns an array containing the 1, 5, and 15 minute load averages.</p>
543<p>The load average is a measure of system activity calculated by the operating
544system and expressed as a fractional number.</p>
545<p>The load average is a Unix-specific concept. On Windows, the return value is
546always <code>[0, 0, 0]</code>.</p>
547</section><section><h3><code>os.machine()</code><span><a class="mark" href="#osmachine" id="osmachine">#</a></span><a aria-hidden="true" class="legacy" id="os_os_machine"></a></h3>
548<div class="api_metadata">
549<span>Added in: v18.9.0</span>
550</div>
551<ul>
552<li>Returns <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
553</ul>
554<p>Returns the machine type as a string, such as <code>arm</code>, <code>arm64</code>, <code>aarch64</code>,
555<code>mips</code>, <code>mips64</code>, <code>ppc64</code>, <code>ppc64le</code>, <code>s390</code>, <code>s390x</code>, <code>i386</code>, <code>i686</code>, <code>x86_64</code>.</p>
556<p>On POSIX systems, the machine type is determined by calling
557<a href="https://linux.die.net/man/3/uname"><code>uname(3)</code></a>. On Windows, <code>RtlGetVersion()</code> is used, and if it is not
558available, <code>GetVersionExW()</code> will be used. See
559<a href="https://en.wikipedia.org/wiki/Uname#Examples">https://en.wikipedia.org/wiki/Uname#Examples</a> for more information.</p>
560</section><section><h3><code>os.networkInterfaces()</code><span><a class="mark" href="#osnetworkinterfaces" id="osnetworkinterfaces">#</a></span><a aria-hidden="true" class="legacy" id="os_os_networkinterfaces"></a></h3>
561<div class="api_metadata">
562<details class="changelog"><summary>History</summary>
563<table>
564<tbody><tr><th>Version</th><th>Changes</th></tr>
565<tr><td>v18.4.0</td>
566<td><p>The <code>family</code> property now returns a string instead of a number.</p></td></tr>
567<tr><td>v18.0.0</td>
568<td><p>The <code>family</code> property now returns a number instead of a string.</p></td></tr>
569<tr><td>v0.6.0</td>
570<td><p><span>Added in: v0.6.0</span></p></td></tr>
571</tbody></table>
572</details>
573</div>
574<ul>
575<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
576</ul>
577<p>Returns an object containing network interfaces that have been assigned a
578network address.</p>
579<p>Each key on the returned object identifies a network interface. The associated
580value is an array of objects that each describe an assigned network address.</p>
581<p>The properties available on the assigned network address object include:</p>
582<ul>
583<li><code>address</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> The assigned IPv4 or IPv6 address</li>
584<li><code>netmask</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> The IPv4 or IPv6 network mask</li>
585<li><code>family</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Either <code>IPv4</code> or <code>IPv6</code></li>
586<li><code>mac</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> The MAC address of the network interface</li>
587<li><code>internal</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&#x3C;boolean></a> <code>true</code> if the network interface is a loopback or
588similar interface that is not remotely accessible; otherwise <code>false</code></li>
589<li><code>scopeid</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a> The numeric IPv6 scope ID (only specified when <code>family</code>
590is <code>IPv6</code>)</li>
591<li><code>cidr</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> The assigned IPv4 or IPv6 address with the routing prefix
592in CIDR notation. If the <code>netmask</code> is invalid, this property is set
593to <code>null</code>.</li>
594</ul>
595<!-- eslint-skip -->
596<pre><code class="language-js">{
597  <span class="hljs-attr">lo</span>: [
598    {
599      <span class="hljs-attr">address</span>: <span class="hljs-string">'127.0.0.1'</span>,
600      <span class="hljs-attr">netmask</span>: <span class="hljs-string">'255.0.0.0'</span>,
601      <span class="hljs-attr">family</span>: <span class="hljs-string">'IPv4'</span>,
602      <span class="hljs-attr">mac</span>: <span class="hljs-string">'00:00:00:00:00:00'</span>,
603      <span class="hljs-attr">internal</span>: <span class="hljs-literal">true</span>,
604      <span class="hljs-attr">cidr</span>: <span class="hljs-string">'127.0.0.1/8'</span>
605    },
606    {
607      <span class="hljs-attr">address</span>: <span class="hljs-string">'::1'</span>,
608      <span class="hljs-attr">netmask</span>: <span class="hljs-string">'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'</span>,
609      <span class="hljs-attr">family</span>: <span class="hljs-string">'IPv6'</span>,
610      <span class="hljs-attr">mac</span>: <span class="hljs-string">'00:00:00:00:00:00'</span>,
611      <span class="hljs-attr">scopeid</span>: <span class="hljs-number">0</span>,
612      <span class="hljs-attr">internal</span>: <span class="hljs-literal">true</span>,
613      <span class="hljs-attr">cidr</span>: <span class="hljs-string">'::1/128'</span>
614    }
615  ],
616  <span class="hljs-attr">eth0</span>: [
617    {
618      <span class="hljs-attr">address</span>: <span class="hljs-string">'192.168.1.108'</span>,
619      <span class="hljs-attr">netmask</span>: <span class="hljs-string">'255.255.255.0'</span>,
620      <span class="hljs-attr">family</span>: <span class="hljs-string">'IPv4'</span>,
621      <span class="hljs-attr">mac</span>: <span class="hljs-string">'01:02:03:0a:0b:0c'</span>,
622      <span class="hljs-attr">internal</span>: <span class="hljs-literal">false</span>,
623      <span class="hljs-attr">cidr</span>: <span class="hljs-string">'192.168.1.108/24'</span>
624    },
625    {
626      <span class="hljs-attr">address</span>: <span class="hljs-string">'fe80::a00:27ff:fe4e:66a1'</span>,
627      <span class="hljs-attr">netmask</span>: <span class="hljs-string">'ffff:ffff:ffff:ffff::'</span>,
628      <span class="hljs-attr">family</span>: <span class="hljs-string">'IPv6'</span>,
629      <span class="hljs-attr">mac</span>: <span class="hljs-string">'01:02:03:0a:0b:0c'</span>,
630      <span class="hljs-attr">scopeid</span>: <span class="hljs-number">1</span>,
631      <span class="hljs-attr">internal</span>: <span class="hljs-literal">false</span>,
632      <span class="hljs-attr">cidr</span>: <span class="hljs-string">'fe80::a00:27ff:fe4e:66a1/64'</span>
633    }
634  ]
635}</code> <button class="copy-button">copy</button></pre>
636</section><section><h3><code>os.platform()</code><span><a class="mark" href="#osplatform" id="osplatform">#</a></span><a aria-hidden="true" class="legacy" id="os_os_platform"></a></h3>
637<div class="api_metadata">
638<span>Added in: v0.5.0</span>
639</div>
640<ul>
641<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
642</ul>
643<p>Returns a string identifying the operating system platform for which
644the Node.js binary was compiled. The value is set at compile time.
645Possible values are <code>'aix'</code>, <code>'darwin'</code>, <code>'freebsd'</code>,<code>'linux'</code>,
646<code>'openbsd'</code>, <code>'sunos'</code>, and <code>'win32'</code>.</p>
647<p>The return value is equivalent to <a href="process.html#processplatform"><code>process.platform</code></a>.</p>
648<p>The value <code>'android'</code> may also be returned if Node.js is built on the Android
649operating system. <a href="https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os">Android support is experimental</a>.</p>
650</section><section><h3><code>os.release()</code><span><a class="mark" href="#osrelease" id="osrelease">#</a></span><a aria-hidden="true" class="legacy" id="os_os_release"></a></h3>
651<div class="api_metadata">
652<span>Added in: v0.3.3</span>
653</div>
654<ul>
655<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
656</ul>
657<p>Returns the operating system as a string.</p>
658<p>On POSIX systems, the operating system release is determined by calling
659<a href="https://linux.die.net/man/3/uname"><code>uname(3)</code></a>. On Windows, <code>GetVersionExW()</code> is used. See
660<a href="https://en.wikipedia.org/wiki/Uname#Examples">https://en.wikipedia.org/wiki/Uname#Examples</a> for more information.</p>
661</section><section><h3><code>os.setPriority([pid, ]priority)</code><span><a class="mark" href="#ossetprioritypid-priority" id="ossetprioritypid-priority">#</a></span><a aria-hidden="true" class="legacy" id="os_os_setpriority_pid_priority"></a></h3>
662<div class="api_metadata">
663<span>Added in: v10.10.0</span>
664</div>
665<ul>
666<li><code>pid</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;integer></a> The process ID to set scheduling priority for.
667<strong>Default:</strong> <code>0</code>.</li>
668<li><code>priority</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;integer></a> The scheduling priority to assign to the process.</li>
669</ul>
670<p>Attempts to set the scheduling priority for the process specified by <code>pid</code>. If
671<code>pid</code> is not provided or is <code>0</code>, the process ID of the current process is used.</p>
672<p>The <code>priority</code> input must be an integer between <code>-20</code> (high priority) and <code>19</code>
673(low priority). Due to differences between Unix priority levels and Windows
674priority classes, <code>priority</code> is mapped to one of six priority constants in
675<code>os.constants.priority</code>. When retrieving a process priority level, this range
676mapping may cause the return value to be slightly different on Windows. To avoid
677confusion, set <code>priority</code> to one of the priority constants.</p>
678<p>On Windows, setting priority to <code>PRIORITY_HIGHEST</code> requires elevated user
679privileges. Otherwise the set priority will be silently reduced to
680<code>PRIORITY_HIGH</code>.</p>
681</section><section><h3><code>os.tmpdir()</code><span><a class="mark" href="#ostmpdir" id="ostmpdir">#</a></span><a aria-hidden="true" class="legacy" id="os_os_tmpdir"></a></h3>
682<div class="api_metadata">
683<details class="changelog"><summary>History</summary>
684<table>
685<tbody><tr><th>Version</th><th>Changes</th></tr>
686<tr><td>v2.0.0</td>
687<td><p>This function is now cross-platform consistent and no longer returns a path with a trailing slash on any platform.</p></td></tr>
688<tr><td>v0.9.9</td>
689<td><p><span>Added in: v0.9.9</span></p></td></tr>
690</tbody></table>
691</details>
692</div>
693<ul>
694<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
695</ul>
696<p>Returns the operating system's default directory for temporary files as a
697string.</p>
698</section><section><h3><code>os.totalmem()</code><span><a class="mark" href="#ostotalmem" id="ostotalmem">#</a></span><a aria-hidden="true" class="legacy" id="os_os_totalmem"></a></h3>
699<div class="api_metadata">
700<span>Added in: v0.3.3</span>
701</div>
702<ul>
703<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;integer></a></li>
704</ul>
705<p>Returns the total amount of system memory in bytes as an integer.</p>
706</section><section><h3><code>os.type()</code><span><a class="mark" href="#ostype" id="ostype">#</a></span><a aria-hidden="true" class="legacy" id="os_os_type"></a></h3>
707<div class="api_metadata">
708<span>Added in: v0.3.3</span>
709</div>
710<ul>
711<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
712</ul>
713<p>Returns the operating system name as returned by <a href="https://linux.die.net/man/3/uname"><code>uname(3)</code></a>. For example, it
714returns <code>'Linux'</code> on Linux, <code>'Darwin'</code> on macOS, and <code>'Windows_NT'</code> on Windows.</p>
715<p>See <a href="https://en.wikipedia.org/wiki/Uname#Examples">https://en.wikipedia.org/wiki/Uname#Examples</a> for additional information
716about the output of running <a href="https://linux.die.net/man/3/uname"><code>uname(3)</code></a> on various operating systems.</p>
717</section><section><h3><code>os.uptime()</code><span><a class="mark" href="#osuptime" id="osuptime">#</a></span><a aria-hidden="true" class="legacy" id="os_os_uptime"></a></h3>
718<div class="api_metadata">
719<details class="changelog"><summary>History</summary>
720<table>
721<tbody><tr><th>Version</th><th>Changes</th></tr>
722<tr><td>v10.0.0</td>
723<td><p>The result of this function no longer contains a fraction component on Windows.</p></td></tr>
724<tr><td>v0.3.3</td>
725<td><p><span>Added in: v0.3.3</span></p></td></tr>
726</tbody></table>
727</details>
728</div>
729<ul>
730<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;integer></a></li>
731</ul>
732<p>Returns the system uptime in number of seconds.</p>
733</section><section><h3><code>os.userInfo([options])</code><span><a class="mark" href="#osuserinfooptions" id="osuserinfooptions">#</a></span><a aria-hidden="true" class="legacy" id="os_os_userinfo_options"></a></h3>
734<div class="api_metadata">
735<span>Added in: v6.0.0</span>
736</div>
737<ul>
738<li><code>options</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>
739<ul>
740<li><code>encoding</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Character encoding used to interpret resulting strings.
741If <code>encoding</code> is set to <code>'buffer'</code>, the <code>username</code>, <code>shell</code>, and <code>homedir</code>
742values will be <code>Buffer</code> instances. <strong>Default:</strong> <code>'utf8'</code>.</li>
743</ul>
744</li>
745<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
746</ul>
747<p>Returns information about the currently effective user. On POSIX platforms,
748this is typically a subset of the password file. The returned object includes
749the <code>username</code>, <code>uid</code>, <code>gid</code>, <code>shell</code>, and <code>homedir</code>. On Windows, the <code>uid</code> and
750<code>gid</code> fields are <code>-1</code>, and <code>shell</code> is <code>null</code>.</p>
751<p>The value of <code>homedir</code> returned by <code>os.userInfo()</code> is provided by the operating
752system. This differs from the result of <code>os.homedir()</code>, which queries
753environment variables for the home directory before falling back to the
754operating system response.</p>
755<p>Throws a <a href="errors.html#class-systemerror"><code>SystemError</code></a> if a user has no <code>username</code> or <code>homedir</code>.</p>
756</section><section><h3><code>os.version()</code><span><a class="mark" href="#osversion" id="osversion">#</a></span><a aria-hidden="true" class="legacy" id="os_os_version"></a></h3>
757<div class="api_metadata">
758<span>Added in: v13.11.0, v12.17.0</span>
759</div>
760<ul>
761<li>Returns <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
762</ul>
763<p>Returns a string identifying the kernel version.</p>
764<p>On POSIX systems, the operating system release is determined by calling
765<a href="https://linux.die.net/man/3/uname"><code>uname(3)</code></a>. On Windows, <code>RtlGetVersion()</code> is used, and if it is not
766available, <code>GetVersionExW()</code> will be used. See
767<a href="https://en.wikipedia.org/wiki/Uname#Examples">https://en.wikipedia.org/wiki/Uname#Examples</a> for more information.</p>
768</section><section><h3>OS constants<span><a class="mark" href="#os-constants" id="os-constants">#</a></span><a aria-hidden="true" class="legacy" id="os_os_constants_1"></a></h3>
769<p>The following constants are exported by <code>os.constants</code>.</p>
770<p>Not all constants will be available on every operating system.</p>
771<h4>Signal constants<span><a class="mark" href="#signal-constants" id="signal-constants">#</a></span><a aria-hidden="true" class="legacy" id="os_signal_constants"></a></h4>
772<div class="api_metadata">
773<details class="changelog"><summary>History</summary>
774<table>
775<tbody><tr><th>Version</th><th>Changes</th></tr>
776<tr><td>v5.11.0</td>
777<td><p>Added support for <code>SIGINFO</code>.</p></td></tr>
778</tbody></table>
779</details>
780</div>
781<p>The following signal constants are exported by <code>os.constants.signals</code>.</p>
782<table>
783  <tbody><tr>
784    <th>Constant</th>
785    <th>Description</th>
786  </tr>
787  <tr>
788    <td><code>SIGHUP</code></td>
789    <td>Sent to indicate when a controlling terminal is closed or a parent
790    process exits.</td>
791  </tr>
792  <tr>
793    <td><code>SIGINT</code></td>
794    <td>Sent to indicate when a user wishes to interrupt a process
795    (<kbd>Ctrl</kbd>+<kbd>C</kbd>).</td>
796  </tr>
797  <tr>
798    <td><code>SIGQUIT</code></td>
799    <td>Sent to indicate when a user wishes to terminate a process and perform a
800    core dump.</td>
801  </tr>
802  <tr>
803    <td><code>SIGILL</code></td>
804    <td>Sent to a process to notify that it has attempted to perform an illegal,
805    malformed, unknown, or privileged instruction.</td>
806  </tr>
807  <tr>
808    <td><code>SIGTRAP</code></td>
809    <td>Sent to a process when an exception has occurred.</td>
810  </tr>
811  <tr>
812    <td><code>SIGABRT</code></td>
813    <td>Sent to a process to request that it abort.</td>
814  </tr>
815  <tr>
816    <td><code>SIGIOT</code></td>
817    <td>Synonym for <code>SIGABRT</code></td>
818  </tr>
819  <tr>
820    <td><code>SIGBUS</code></td>
821    <td>Sent to a process to notify that it has caused a bus error.</td>
822  </tr>
823  <tr>
824    <td><code>SIGFPE</code></td>
825    <td>Sent to a process to notify that it has performed an illegal arithmetic
826    operation.</td>
827  </tr>
828  <tr>
829    <td><code>SIGKILL</code></td>
830    <td>Sent to a process to terminate it immediately.</td>
831  </tr>
832  <tr>
833    <td><code>SIGUSR1</code> <code>SIGUSR2</code></td>
834    <td>Sent to a process to identify user-defined conditions.</td>
835  </tr>
836  <tr>
837    <td><code>SIGSEGV</code></td>
838    <td>Sent to a process to notify of a segmentation fault.</td>
839  </tr>
840  <tr>
841    <td><code>SIGPIPE</code></td>
842    <td>Sent to a process when it has attempted to write to a disconnected
843    pipe.</td>
844  </tr>
845  <tr>
846    <td><code>SIGALRM</code></td>
847    <td>Sent to a process when a system timer elapses.</td>
848  </tr>
849  <tr>
850    <td><code>SIGTERM</code></td>
851    <td>Sent to a process to request termination.</td>
852  </tr>
853  <tr>
854    <td><code>SIGCHLD</code></td>
855    <td>Sent to a process when a child process terminates.</td>
856  </tr>
857  <tr>
858    <td><code>SIGSTKFLT</code></td>
859    <td>Sent to a process to indicate a stack fault on a coprocessor.</td>
860  </tr>
861  <tr>
862    <td><code>SIGCONT</code></td>
863    <td>Sent to instruct the operating system to continue a paused process.</td>
864  </tr>
865  <tr>
866    <td><code>SIGSTOP</code></td>
867    <td>Sent to instruct the operating system to halt a process.</td>
868  </tr>
869  <tr>
870    <td><code>SIGTSTP</code></td>
871    <td>Sent to a process to request it to stop.</td>
872  </tr>
873  <tr>
874    <td><code>SIGBREAK</code></td>
875    <td>Sent to indicate when a user wishes to interrupt a process.</td>
876  </tr>
877  <tr>
878    <td><code>SIGTTIN</code></td>
879    <td>Sent to a process when it reads from the TTY while in the
880    background.</td>
881  </tr>
882  <tr>
883    <td><code>SIGTTOU</code></td>
884    <td>Sent to a process when it writes to the TTY while in the
885    background.</td>
886  </tr>
887  <tr>
888    <td><code>SIGURG</code></td>
889    <td>Sent to a process when a socket has urgent data to read.</td>
890  </tr>
891  <tr>
892    <td><code>SIGXCPU</code></td>
893    <td>Sent to a process when it has exceeded its limit on CPU usage.</td>
894  </tr>
895  <tr>
896    <td><code>SIGXFSZ</code></td>
897    <td>Sent to a process when it grows a file larger than the maximum
898    allowed.</td>
899  </tr>
900  <tr>
901    <td><code>SIGVTALRM</code></td>
902    <td>Sent to a process when a virtual timer has elapsed.</td>
903  </tr>
904  <tr>
905    <td><code>SIGPROF</code></td>
906    <td>Sent to a process when a system timer has elapsed.</td>
907  </tr>
908  <tr>
909    <td><code>SIGWINCH</code></td>
910    <td>Sent to a process when the controlling terminal has changed its
911    size.</td>
912  </tr>
913  <tr>
914    <td><code>SIGIO</code></td>
915    <td>Sent to a process when I/O is available.</td>
916  </tr>
917  <tr>
918    <td><code>SIGPOLL</code></td>
919    <td>Synonym for <code>SIGIO</code></td>
920  </tr>
921  <tr>
922    <td><code>SIGLOST</code></td>
923    <td>Sent to a process when a file lock has been lost.</td>
924  </tr>
925  <tr>
926    <td><code>SIGPWR</code></td>
927    <td>Sent to a process to notify of a power failure.</td>
928  </tr>
929  <tr>
930    <td><code>SIGINFO</code></td>
931    <td>Synonym for <code>SIGPWR</code></td>
932  </tr>
933  <tr>
934    <td><code>SIGSYS</code></td>
935    <td>Sent to a process to notify of a bad argument.</td>
936  </tr>
937  <tr>
938    <td><code>SIGUNUSED</code></td>
939    <td>Synonym for <code>SIGSYS</code></td>
940  </tr>
941</tbody></table>
942<h4>Error constants<span><a class="mark" href="#error-constants" id="error-constants">#</a></span><a aria-hidden="true" class="legacy" id="os_error_constants"></a></h4>
943<p>The following error constants are exported by <code>os.constants.errno</code>.</p>
944<h5>POSIX error constants<span><a class="mark" href="#posix-error-constants" id="posix-error-constants">#</a></span><a aria-hidden="true" class="legacy" id="os_posix_error_constants"></a></h5>
945<table>
946  <tbody><tr>
947    <th>Constant</th>
948    <th>Description</th>
949  </tr>
950  <tr>
951    <td><code>E2BIG</code></td>
952    <td>Indicates that the list of arguments is longer than expected.</td>
953  </tr>
954  <tr>
955    <td><code>EACCES</code></td>
956    <td>Indicates that the operation did not have sufficient permissions.</td>
957  </tr>
958  <tr>
959    <td><code>EADDRINUSE</code></td>
960    <td>Indicates that the network address is already in use.</td>
961  </tr>
962  <tr>
963    <td><code>EADDRNOTAVAIL</code></td>
964    <td>Indicates that the network address is currently unavailable for
965    use.</td>
966  </tr>
967  <tr>
968    <td><code>EAFNOSUPPORT</code></td>
969    <td>Indicates that the network address family is not supported.</td>
970  </tr>
971  <tr>
972    <td><code>EAGAIN</code></td>
973    <td>Indicates that there is no data available and to try the
974    operation again later.</td>
975  </tr>
976  <tr>
977    <td><code>EALREADY</code></td>
978    <td>Indicates that the socket already has a pending connection in
979    progress.</td>
980  </tr>
981  <tr>
982    <td><code>EBADF</code></td>
983    <td>Indicates that a file descriptor is not valid.</td>
984  </tr>
985  <tr>
986    <td><code>EBADMSG</code></td>
987    <td>Indicates an invalid data message.</td>
988  </tr>
989  <tr>
990    <td><code>EBUSY</code></td>
991    <td>Indicates that a device or resource is busy.</td>
992  </tr>
993  <tr>
994    <td><code>ECANCELED</code></td>
995    <td>Indicates that an operation was canceled.</td>
996  </tr>
997  <tr>
998    <td><code>ECHILD</code></td>
999    <td>Indicates that there are no child processes.</td>
1000  </tr>
1001  <tr>
1002    <td><code>ECONNABORTED</code></td>
1003    <td>Indicates that the network connection has been aborted.</td>
1004  </tr>
1005  <tr>
1006    <td><code>ECONNREFUSED</code></td>
1007    <td>Indicates that the network connection has been refused.</td>
1008  </tr>
1009  <tr>
1010    <td><code>ECONNRESET</code></td>
1011    <td>Indicates that the network connection has been reset.</td>
1012  </tr>
1013  <tr>
1014    <td><code>EDEADLK</code></td>
1015    <td>Indicates that a resource deadlock has been avoided.</td>
1016  </tr>
1017  <tr>
1018    <td><code>EDESTADDRREQ</code></td>
1019    <td>Indicates that a destination address is required.</td>
1020  </tr>
1021  <tr>
1022    <td><code>EDOM</code></td>
1023    <td>Indicates that an argument is out of the domain of the function.</td>
1024  </tr>
1025  <tr>
1026    <td><code>EDQUOT</code></td>
1027    <td>Indicates that the disk quota has been exceeded.</td>
1028  </tr>
1029  <tr>
1030    <td><code>EEXIST</code></td>
1031    <td>Indicates that the file already exists.</td>
1032  </tr>
1033  <tr>
1034    <td><code>EFAULT</code></td>
1035    <td>Indicates an invalid pointer address.</td>
1036  </tr>
1037  <tr>
1038    <td><code>EFBIG</code></td>
1039    <td>Indicates that the file is too large.</td>
1040  </tr>
1041  <tr>
1042    <td><code>EHOSTUNREACH</code></td>
1043    <td>Indicates that the host is unreachable.</td>
1044  </tr>
1045  <tr>
1046    <td><code>EIDRM</code></td>
1047    <td>Indicates that the identifier has been removed.</td>
1048  </tr>
1049  <tr>
1050    <td><code>EILSEQ</code></td>
1051    <td>Indicates an illegal byte sequence.</td>
1052  </tr>
1053  <tr>
1054    <td><code>EINPROGRESS</code></td>
1055    <td>Indicates that an operation is already in progress.</td>
1056  </tr>
1057  <tr>
1058    <td><code>EINTR</code></td>
1059    <td>Indicates that a function call was interrupted.</td>
1060  </tr>
1061  <tr>
1062    <td><code>EINVAL</code></td>
1063    <td>Indicates that an invalid argument was provided.</td>
1064  </tr>
1065  <tr>
1066    <td><code>EIO</code></td>
1067    <td>Indicates an otherwise unspecified I/O error.</td>
1068  </tr>
1069  <tr>
1070    <td><code>EISCONN</code></td>
1071    <td>Indicates that the socket is connected.</td>
1072  </tr>
1073  <tr>
1074    <td><code>EISDIR</code></td>
1075    <td>Indicates that the path is a directory.</td>
1076  </tr>
1077  <tr>
1078    <td><code>ELOOP</code></td>
1079    <td>Indicates too many levels of symbolic links in a path.</td>
1080  </tr>
1081  <tr>
1082    <td><code>EMFILE</code></td>
1083    <td>Indicates that there are too many open files.</td>
1084  </tr>
1085  <tr>
1086    <td><code>EMLINK</code></td>
1087    <td>Indicates that there are too many hard links to a file.</td>
1088  </tr>
1089  <tr>
1090    <td><code>EMSGSIZE</code></td>
1091    <td>Indicates that the provided message is too long.</td>
1092  </tr>
1093  <tr>
1094    <td><code>EMULTIHOP</code></td>
1095    <td>Indicates that a multihop was attempted.</td>
1096  </tr>
1097  <tr>
1098    <td><code>ENAMETOOLONG</code></td>
1099    <td>Indicates that the filename is too long.</td>
1100  </tr>
1101  <tr>
1102    <td><code>ENETDOWN</code></td>
1103    <td>Indicates that the network is down.</td>
1104  </tr>
1105  <tr>
1106    <td><code>ENETRESET</code></td>
1107    <td>Indicates that the connection has been aborted by the network.</td>
1108  </tr>
1109  <tr>
1110    <td><code>ENETUNREACH</code></td>
1111    <td>Indicates that the network is unreachable.</td>
1112  </tr>
1113  <tr>
1114    <td><code>ENFILE</code></td>
1115    <td>Indicates too many open files in the system.</td>
1116  </tr>
1117  <tr>
1118    <td><code>ENOBUFS</code></td>
1119    <td>Indicates that no buffer space is available.</td>
1120  </tr>
1121  <tr>
1122    <td><code>ENODATA</code></td>
1123    <td>Indicates that no message is available on the stream head read
1124    queue.</td>
1125  </tr>
1126  <tr>
1127    <td><code>ENODEV</code></td>
1128    <td>Indicates that there is no such device.</td>
1129  </tr>
1130  <tr>
1131    <td><code>ENOENT</code></td>
1132    <td>Indicates that there is no such file or directory.</td>
1133  </tr>
1134  <tr>
1135    <td><code>ENOEXEC</code></td>
1136    <td>Indicates an exec format error.</td>
1137  </tr>
1138  <tr>
1139    <td><code>ENOLCK</code></td>
1140    <td>Indicates that there are no locks available.</td>
1141  </tr>
1142  <tr>
1143    <td><code>ENOLINK</code></td>
1144    <td>Indications that a link has been severed.</td>
1145  </tr>
1146  <tr>
1147    <td><code>ENOMEM</code></td>
1148    <td>Indicates that there is not enough space.</td>
1149  </tr>
1150  <tr>
1151    <td><code>ENOMSG</code></td>
1152    <td>Indicates that there is no message of the desired type.</td>
1153  </tr>
1154  <tr>
1155    <td><code>ENOPROTOOPT</code></td>
1156    <td>Indicates that a given protocol is not available.</td>
1157  </tr>
1158  <tr>
1159    <td><code>ENOSPC</code></td>
1160    <td>Indicates that there is no space available on the device.</td>
1161  </tr>
1162  <tr>
1163    <td><code>ENOSR</code></td>
1164    <td>Indicates that there are no stream resources available.</td>
1165  </tr>
1166  <tr>
1167    <td><code>ENOSTR</code></td>
1168    <td>Indicates that a given resource is not a stream.</td>
1169  </tr>
1170  <tr>
1171    <td><code>ENOSYS</code></td>
1172    <td>Indicates that a function has not been implemented.</td>
1173  </tr>
1174  <tr>
1175    <td><code>ENOTCONN</code></td>
1176    <td>Indicates that the socket is not connected.</td>
1177  </tr>
1178  <tr>
1179    <td><code>ENOTDIR</code></td>
1180    <td>Indicates that the path is not a directory.</td>
1181  </tr>
1182  <tr>
1183    <td><code>ENOTEMPTY</code></td>
1184    <td>Indicates that the directory is not empty.</td>
1185  </tr>
1186  <tr>
1187    <td><code>ENOTSOCK</code></td>
1188    <td>Indicates that the given item is not a socket.</td>
1189  </tr>
1190  <tr>
1191    <td><code>ENOTSUP</code></td>
1192    <td>Indicates that a given operation is not supported.</td>
1193  </tr>
1194  <tr>
1195    <td><code>ENOTTY</code></td>
1196    <td>Indicates an inappropriate I/O control operation.</td>
1197  </tr>
1198  <tr>
1199    <td><code>ENXIO</code></td>
1200    <td>Indicates no such device or address.</td>
1201  </tr>
1202  <tr>
1203    <td><code>EOPNOTSUPP</code></td>
1204    <td>Indicates that an operation is not supported on the socket. Although
1205    <code>ENOTSUP</code> and <code>EOPNOTSUPP</code> have the same value
1206    on Linux, according to POSIX.1 these error values should be distinct.)</td>
1207  </tr>
1208  <tr>
1209    <td><code>EOVERFLOW</code></td>
1210    <td>Indicates that a value is too large to be stored in a given data
1211    type.</td>
1212  </tr>
1213  <tr>
1214    <td><code>EPERM</code></td>
1215    <td>Indicates that the operation is not permitted.</td>
1216  </tr>
1217  <tr>
1218    <td><code>EPIPE</code></td>
1219    <td>Indicates a broken pipe.</td>
1220  </tr>
1221  <tr>
1222    <td><code>EPROTO</code></td>
1223    <td>Indicates a protocol error.</td>
1224  </tr>
1225  <tr>
1226    <td><code>EPROTONOSUPPORT</code></td>
1227    <td>Indicates that a protocol is not supported.</td>
1228  </tr>
1229  <tr>
1230    <td><code>EPROTOTYPE</code></td>
1231    <td>Indicates the wrong type of protocol for a socket.</td>
1232  </tr>
1233  <tr>
1234    <td><code>ERANGE</code></td>
1235    <td>Indicates that the results are too large.</td>
1236  </tr>
1237  <tr>
1238    <td><code>EROFS</code></td>
1239    <td>Indicates that the file system is read only.</td>
1240  </tr>
1241  <tr>
1242    <td><code>ESPIPE</code></td>
1243    <td>Indicates an invalid seek operation.</td>
1244  </tr>
1245  <tr>
1246    <td><code>ESRCH</code></td>
1247    <td>Indicates that there is no such process.</td>
1248  </tr>
1249  <tr>
1250    <td><code>ESTALE</code></td>
1251    <td>Indicates that the file handle is stale.</td>
1252  </tr>
1253  <tr>
1254    <td><code>ETIME</code></td>
1255    <td>Indicates an expired timer.</td>
1256  </tr>
1257  <tr>
1258    <td><code>ETIMEDOUT</code></td>
1259    <td>Indicates that the connection timed out.</td>
1260  </tr>
1261  <tr>
1262    <td><code>ETXTBSY</code></td>
1263    <td>Indicates that a text file is busy.</td>
1264  </tr>
1265  <tr>
1266    <td><code>EWOULDBLOCK</code></td>
1267    <td>Indicates that the operation would block.</td>
1268  </tr>
1269  <tr>
1270    <td><code>EXDEV</code></td>
1271    <td>Indicates an improper link.</td>
1272  </tr>
1273</tbody></table>
1274<h5>Windows-specific error constants<span><a class="mark" href="#windows-specific-error-constants" id="windows-specific-error-constants">#</a></span><a aria-hidden="true" class="legacy" id="os_windows_specific_error_constants"></a></h5>
1275<p>The following error codes are specific to the Windows operating system.</p>
1276<table>
1277  <tbody><tr>
1278    <th>Constant</th>
1279    <th>Description</th>
1280  </tr>
1281  <tr>
1282    <td><code>WSAEINTR</code></td>
1283    <td>Indicates an interrupted function call.</td>
1284  </tr>
1285  <tr>
1286    <td><code>WSAEBADF</code></td>
1287    <td>Indicates an invalid file handle.</td>
1288  </tr>
1289  <tr>
1290    <td><code>WSAEACCES</code></td>
1291    <td>Indicates insufficient permissions to complete the operation.</td>
1292  </tr>
1293  <tr>
1294    <td><code>WSAEFAULT</code></td>
1295    <td>Indicates an invalid pointer address.</td>
1296  </tr>
1297  <tr>
1298    <td><code>WSAEINVAL</code></td>
1299    <td>Indicates that an invalid argument was passed.</td>
1300  </tr>
1301  <tr>
1302    <td><code>WSAEMFILE</code></td>
1303    <td>Indicates that there are too many open files.</td>
1304  </tr>
1305  <tr>
1306    <td><code>WSAEWOULDBLOCK</code></td>
1307    <td>Indicates that a resource is temporarily unavailable.</td>
1308  </tr>
1309  <tr>
1310    <td><code>WSAEINPROGRESS</code></td>
1311    <td>Indicates that an operation is currently in progress.</td>
1312  </tr>
1313  <tr>
1314    <td><code>WSAEALREADY</code></td>
1315    <td>Indicates that an operation is already in progress.</td>
1316  </tr>
1317  <tr>
1318    <td><code>WSAENOTSOCK</code></td>
1319    <td>Indicates that the resource is not a socket.</td>
1320  </tr>
1321  <tr>
1322    <td><code>WSAEDESTADDRREQ</code></td>
1323    <td>Indicates that a destination address is required.</td>
1324  </tr>
1325  <tr>
1326    <td><code>WSAEMSGSIZE</code></td>
1327    <td>Indicates that the message size is too long.</td>
1328  </tr>
1329  <tr>
1330    <td><code>WSAEPROTOTYPE</code></td>
1331    <td>Indicates the wrong protocol type for the socket.</td>
1332  </tr>
1333  <tr>
1334    <td><code>WSAENOPROTOOPT</code></td>
1335    <td>Indicates a bad protocol option.</td>
1336  </tr>
1337  <tr>
1338    <td><code>WSAEPROTONOSUPPORT</code></td>
1339    <td>Indicates that the protocol is not supported.</td>
1340  </tr>
1341  <tr>
1342    <td><code>WSAESOCKTNOSUPPORT</code></td>
1343    <td>Indicates that the socket type is not supported.</td>
1344  </tr>
1345  <tr>
1346    <td><code>WSAEOPNOTSUPP</code></td>
1347    <td>Indicates that the operation is not supported.</td>
1348  </tr>
1349  <tr>
1350    <td><code>WSAEPFNOSUPPORT</code></td>
1351    <td>Indicates that the protocol family is not supported.</td>
1352  </tr>
1353  <tr>
1354    <td><code>WSAEAFNOSUPPORT</code></td>
1355    <td>Indicates that the address family is not supported.</td>
1356  </tr>
1357  <tr>
1358    <td><code>WSAEADDRINUSE</code></td>
1359    <td>Indicates that the network address is already in use.</td>
1360  </tr>
1361  <tr>
1362    <td><code>WSAEADDRNOTAVAIL</code></td>
1363    <td>Indicates that the network address is not available.</td>
1364  </tr>
1365  <tr>
1366    <td><code>WSAENETDOWN</code></td>
1367    <td>Indicates that the network is down.</td>
1368  </tr>
1369  <tr>
1370    <td><code>WSAENETUNREACH</code></td>
1371    <td>Indicates that the network is unreachable.</td>
1372  </tr>
1373  <tr>
1374    <td><code>WSAENETRESET</code></td>
1375    <td>Indicates that the network connection has been reset.</td>
1376  </tr>
1377  <tr>
1378    <td><code>WSAECONNABORTED</code></td>
1379    <td>Indicates that the connection has been aborted.</td>
1380  </tr>
1381  <tr>
1382    <td><code>WSAECONNRESET</code></td>
1383    <td>Indicates that the connection has been reset by the peer.</td>
1384  </tr>
1385  <tr>
1386    <td><code>WSAENOBUFS</code></td>
1387    <td>Indicates that there is no buffer space available.</td>
1388  </tr>
1389  <tr>
1390    <td><code>WSAEISCONN</code></td>
1391    <td>Indicates that the socket is already connected.</td>
1392  </tr>
1393  <tr>
1394    <td><code>WSAENOTCONN</code></td>
1395    <td>Indicates that the socket is not connected.</td>
1396  </tr>
1397  <tr>
1398    <td><code>WSAESHUTDOWN</code></td>
1399    <td>Indicates that data cannot be sent after the socket has been
1400    shutdown.</td>
1401  </tr>
1402  <tr>
1403    <td><code>WSAETOOMANYREFS</code></td>
1404    <td>Indicates that there are too many references.</td>
1405  </tr>
1406  <tr>
1407    <td><code>WSAETIMEDOUT</code></td>
1408    <td>Indicates that the connection has timed out.</td>
1409  </tr>
1410  <tr>
1411    <td><code>WSAECONNREFUSED</code></td>
1412    <td>Indicates that the connection has been refused.</td>
1413  </tr>
1414  <tr>
1415    <td><code>WSAELOOP</code></td>
1416    <td>Indicates that a name cannot be translated.</td>
1417  </tr>
1418  <tr>
1419    <td><code>WSAENAMETOOLONG</code></td>
1420    <td>Indicates that a name was too long.</td>
1421  </tr>
1422  <tr>
1423    <td><code>WSAEHOSTDOWN</code></td>
1424    <td>Indicates that a network host is down.</td>
1425  </tr>
1426  <tr>
1427    <td><code>WSAEHOSTUNREACH</code></td>
1428    <td>Indicates that there is no route to a network host.</td>
1429  </tr>
1430  <tr>
1431    <td><code>WSAENOTEMPTY</code></td>
1432    <td>Indicates that the directory is not empty.</td>
1433  </tr>
1434  <tr>
1435    <td><code>WSAEPROCLIM</code></td>
1436    <td>Indicates that there are too many processes.</td>
1437  </tr>
1438  <tr>
1439    <td><code>WSAEUSERS</code></td>
1440    <td>Indicates that the user quota has been exceeded.</td>
1441  </tr>
1442  <tr>
1443    <td><code>WSAEDQUOT</code></td>
1444    <td>Indicates that the disk quota has been exceeded.</td>
1445  </tr>
1446  <tr>
1447    <td><code>WSAESTALE</code></td>
1448    <td>Indicates a stale file handle reference.</td>
1449  </tr>
1450  <tr>
1451    <td><code>WSAEREMOTE</code></td>
1452    <td>Indicates that the item is remote.</td>
1453  </tr>
1454  <tr>
1455    <td><code>WSASYSNOTREADY</code></td>
1456    <td>Indicates that the network subsystem is not ready.</td>
1457  </tr>
1458  <tr>
1459    <td><code>WSAVERNOTSUPPORTED</code></td>
1460    <td>Indicates that the <code>winsock.dll</code> version is out of
1461    range.</td>
1462  </tr>
1463  <tr>
1464    <td><code>WSANOTINITIALISED</code></td>
1465    <td>Indicates that successful WSAStartup has not yet been performed.</td>
1466  </tr>
1467  <tr>
1468    <td><code>WSAEDISCON</code></td>
1469    <td>Indicates that a graceful shutdown is in progress.</td>
1470  </tr>
1471  <tr>
1472    <td><code>WSAENOMORE</code></td>
1473    <td>Indicates that there are no more results.</td>
1474  </tr>
1475  <tr>
1476    <td><code>WSAECANCELLED</code></td>
1477    <td>Indicates that an operation has been canceled.</td>
1478  </tr>
1479  <tr>
1480    <td><code>WSAEINVALIDPROCTABLE</code></td>
1481    <td>Indicates that the procedure call table is invalid.</td>
1482  </tr>
1483  <tr>
1484    <td><code>WSAEINVALIDPROVIDER</code></td>
1485    <td>Indicates an invalid service provider.</td>
1486  </tr>
1487  <tr>
1488    <td><code>WSAEPROVIDERFAILEDINIT</code></td>
1489    <td>Indicates that the service provider failed to initialized.</td>
1490  </tr>
1491  <tr>
1492    <td><code>WSASYSCALLFAILURE</code></td>
1493    <td>Indicates a system call failure.</td>
1494  </tr>
1495  <tr>
1496    <td><code>WSASERVICE_NOT_FOUND</code></td>
1497    <td>Indicates that a service was not found.</td>
1498  </tr>
1499  <tr>
1500    <td><code>WSATYPE_NOT_FOUND</code></td>
1501    <td>Indicates that a class type was not found.</td>
1502  </tr>
1503  <tr>
1504    <td><code>WSA_E_NO_MORE</code></td>
1505    <td>Indicates that there are no more results.</td>
1506  </tr>
1507  <tr>
1508    <td><code>WSA_E_CANCELLED</code></td>
1509    <td>Indicates that the call was canceled.</td>
1510  </tr>
1511  <tr>
1512    <td><code>WSAEREFUSED</code></td>
1513    <td>Indicates that a database query was refused.</td>
1514  </tr>
1515</tbody></table>
1516<h4>dlopen constants<span><a class="mark" href="#dlopen-constants" id="dlopen-constants">#</a></span><a aria-hidden="true" class="legacy" id="os_dlopen_constants"></a></h4>
1517<p>If available on the operating system, the following constants
1518are exported in <code>os.constants.dlopen</code>. See <a href="http://man7.org/linux/man-pages/man3/dlopen.3.html"><code>dlopen(3)</code></a> for detailed
1519information.</p>
1520<table>
1521  <tbody><tr>
1522    <th>Constant</th>
1523    <th>Description</th>
1524  </tr>
1525  <tr>
1526    <td><code>RTLD_LAZY</code></td>
1527    <td>Perform lazy binding. Node.js sets this flag by default.</td>
1528  </tr>
1529  <tr>
1530    <td><code>RTLD_NOW</code></td>
1531    <td>Resolve all undefined symbols in the library before dlopen(3)
1532    returns.</td>
1533  </tr>
1534  <tr>
1535    <td><code>RTLD_GLOBAL</code></td>
1536    <td>Symbols defined by the library will be made available for symbol
1537    resolution of subsequently loaded libraries.</td>
1538  </tr>
1539  <tr>
1540    <td><code>RTLD_LOCAL</code></td>
1541    <td>The converse of <code>RTLD_GLOBAL</code>. This is the default behavior
1542    if neither flag is specified.</td>
1543  </tr>
1544  <tr>
1545    <td><code>RTLD_DEEPBIND</code></td>
1546    <td>Make a self-contained library use its own symbols in preference to
1547    symbols from previously loaded libraries.</td>
1548  </tr>
1549</tbody></table>
1550<h4>Priority constants<span><a class="mark" href="#priority-constants" id="priority-constants">#</a></span><a aria-hidden="true" class="legacy" id="os_priority_constants"></a></h4>
1551<div class="api_metadata">
1552<span>Added in: v10.10.0</span>
1553</div>
1554<p>The following process scheduling constants are exported by
1555<code>os.constants.priority</code>.</p>
1556<table>
1557  <tbody><tr>
1558    <th>Constant</th>
1559    <th>Description</th>
1560  </tr>
1561  <tr>
1562    <td><code>PRIORITY_LOW</code></td>
1563    <td>The lowest process scheduling priority. This corresponds to
1564    <code>IDLE_PRIORITY_CLASS</code> on Windows, and a nice value of
1565    <code>19</code> on all other platforms.</td>
1566  </tr>
1567  <tr>
1568    <td><code>PRIORITY_BELOW_NORMAL</code></td>
1569    <td>The process scheduling priority above <code>PRIORITY_LOW</code> and
1570    below <code>PRIORITY_NORMAL</code>. This corresponds to
1571    <code>BELOW_NORMAL_PRIORITY_CLASS</code> on Windows, and a nice value of
1572    <code>10</code> on all other platforms.</td>
1573  </tr>
1574  <tr>
1575    <td><code>PRIORITY_NORMAL</code></td>
1576    <td>The default process scheduling priority. This corresponds to
1577    <code>NORMAL_PRIORITY_CLASS</code> on Windows, and a nice value of
1578    <code>0</code> on all other platforms.</td>
1579  </tr>
1580  <tr>
1581    <td><code>PRIORITY_ABOVE_NORMAL</code></td>
1582    <td>The process scheduling priority above <code>PRIORITY_NORMAL</code> and
1583    below <code>PRIORITY_HIGH</code>. This corresponds to
1584    <code>ABOVE_NORMAL_PRIORITY_CLASS</code> on Windows, and a nice value of
1585    <code>-7</code> on all other platforms.</td>
1586  </tr>
1587  <tr>
1588    <td><code>PRIORITY_HIGH</code></td>
1589    <td>The process scheduling priority above <code>PRIORITY_ABOVE_NORMAL</code>
1590    and below <code>PRIORITY_HIGHEST</code>. This corresponds to
1591    <code>HIGH_PRIORITY_CLASS</code> on Windows, and a nice value of
1592    <code>-14</code> on all other platforms.</td>
1593  </tr>
1594  <tr>
1595    <td><code>PRIORITY_HIGHEST</code></td>
1596    <td>The highest process scheduling priority. This corresponds to
1597    <code>REALTIME_PRIORITY_CLASS</code> on Windows, and a nice value of
1598    <code>-20</code> on all other platforms.</td>
1599  </tr>
1600</tbody></table>
1601<h4>libuv constants<span><a class="mark" href="#libuv-constants" id="libuv-constants">#</a></span><a aria-hidden="true" class="legacy" id="os_libuv_constants"></a></h4>
1602<table>
1603  <tbody><tr>
1604    <th>Constant</th>
1605    <th>Description</th>
1606  </tr>
1607  <tr>
1608    <td><code>UV_UDP_REUSEADDR</code></td>
1609    <td></td>
1610  </tr>
1611</tbody></table></section>
1612        <!-- API END -->
1613      </div>
1614    </div>
1615  </div>
1616</body>
1617</html>
1618