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