{
  "source": "doc/api/os.md",
  "modules": [
    {
      "textRaw": "OS",
      "name": "os",
      "stability": 2,
      "stabilityText": "Stable",
      "desc": "<p>Provides a few basic operating-system related utility functions.</p>\n<p>Use <code>require(&#39;os&#39;)</code> to access this module.</p>\n",
      "properties": [
        {
          "textRaw": "os.EOL",
          "name": "EOL",
          "meta": {
            "added": [
              "v0.7.8"
            ]
          },
          "desc": "<p>A constant defining the appropriate End-of-line marker for the operating\nsystem.</p>\n"
        }
      ],
      "methods": [
        {
          "textRaw": "os.arch()",
          "type": "method",
          "name": "arch",
          "meta": {
            "added": [
              "v0.5.0"
            ]
          },
          "desc": "<p>Returns the operating system CPU architecture. Possible values are <code>&#39;x64&#39;</code>,\n<code>&#39;arm&#39;</code> and <code>&#39;ia32&#39;</code>. Returns the value of [<code>process.arch</code>][].</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.cpus()",
          "type": "method",
          "name": "cpus",
          "meta": {
            "added": [
              "v0.3.3"
            ]
          },
          "desc": "<p>Returns an array of objects containing information about each CPU/core\ninstalled: model, speed (in MHz), and times (an object containing the number of\nmilliseconds the CPU/core spent in: user, nice, sys, idle, and irq).</p>\n<p>Example inspection of os.cpus:</p>\n<pre><code class=\"lang-js\">[ { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,\n    speed: 2926,\n    times:\n     { user: 252020,\n       nice: 0,\n       sys: 30340,\n       idle: 1070356870,\n       irq: 0 } },\n  { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,\n    speed: 2926,\n    times:\n     { user: 306960,\n       nice: 0,\n       sys: 26980,\n       idle: 1071569080,\n       irq: 0 } },\n  { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,\n    speed: 2926,\n    times:\n     { user: 248450,\n       nice: 0,\n       sys: 21750,\n       idle: 1070919370,\n       irq: 0 } },\n  { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,\n    speed: 2926,\n    times:\n     { user: 256880,\n       nice: 0,\n       sys: 19430,\n       idle: 1070905480,\n       irq: 20 } },\n  { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,\n    speed: 2926,\n    times:\n     { user: 511580,\n       nice: 20,\n       sys: 40900,\n       idle: 1070842510,\n       irq: 0 } },\n  { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,\n    speed: 2926,\n    times:\n     { user: 291660,\n       nice: 0,\n       sys: 34360,\n       idle: 1070888000,\n       irq: 10 } },\n  { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,\n    speed: 2926,\n    times:\n     { user: 308260,\n       nice: 0,\n       sys: 55410,\n       idle: 1071129970,\n       irq: 880 } },\n  { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,\n    speed: 2926,\n    times:\n     { user: 266450,\n       nice: 1480,\n       sys: 34920,\n       idle: 1072572010,\n       irq: 30 } } ]\n</code></pre>\n<p>Note that since <code>nice</code> values are UNIX centric in Windows the <code>nice</code> values of\nall processors are always 0.</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.endianness()",
          "type": "method",
          "name": "endianness",
          "meta": {
            "added": [
              "v0.9.4"
            ]
          },
          "desc": "<p>Returns the endianness of the CPU. Possible values are <code>&#39;BE&#39;</code> for big endian\nor <code>&#39;LE&#39;</code> for little endian.</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.freemem()",
          "type": "method",
          "name": "freemem",
          "meta": {
            "added": [
              "v0.3.3"
            ]
          },
          "desc": "<p>Returns the amount of free system memory in bytes.</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.homedir()",
          "type": "method",
          "name": "homedir",
          "meta": {
            "added": [
              "v2.3.0"
            ]
          },
          "desc": "<p>Returns the home directory of the current user.</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.hostname()",
          "type": "method",
          "name": "hostname",
          "meta": {
            "added": [
              "v0.3.3"
            ]
          },
          "desc": "<p>Returns the hostname of the operating system.</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.loadavg()",
          "type": "method",
          "name": "loadavg",
          "meta": {
            "added": [
              "v0.3.3"
            ]
          },
          "desc": "<p>Returns an array containing the 1, 5, and 15 minute load averages.</p>\n<p>The load average is a measure of system activity, calculated by the operating\nsystem and expressed as a fractional number.  As a rule of thumb, the load\naverage should ideally be less than the number of logical CPUs in the system.</p>\n<p>The load average is a very UNIX-y concept; there is no real equivalent on\nWindows platforms.  That is why this function always returns <code>[0, 0, 0]</code> on\nWindows.</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.networkInterfaces()",
          "type": "method",
          "name": "networkInterfaces",
          "meta": {
            "added": [
              "v0.6.0"
            ]
          },
          "desc": "<p>Get a list of network interfaces:</p>\n<pre><code class=\"lang-js\">{ lo:\n   [ { address: &#39;127.0.0.1&#39;,\n       netmask: &#39;255.0.0.0&#39;,\n       family: &#39;IPv4&#39;,\n       mac: &#39;00:00:00:00:00:00&#39;,\n       internal: true },\n     { address: &#39;::1&#39;,\n       netmask: &#39;ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff&#39;,\n       family: &#39;IPv6&#39;,\n       mac: &#39;00:00:00:00:00:00&#39;,\n       internal: true } ],\n  eth0:\n   [ { address: &#39;192.168.1.108&#39;,\n       netmask: &#39;255.255.255.0&#39;,\n       family: &#39;IPv4&#39;,\n       mac: &#39;01:02:03:0a:0b:0c&#39;,\n       internal: false },\n     { address: &#39;fe80::a00:27ff:fe4e:66a1&#39;,\n       netmask: &#39;ffff:ffff:ffff:ffff::&#39;,\n       family: &#39;IPv6&#39;,\n       mac: &#39;01:02:03:0a:0b:0c&#39;,\n       internal: false } ] }\n</code></pre>\n<p>Note that due to the underlying implementation this will only return network\ninterfaces that have been assigned an address.</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.platform()",
          "type": "method",
          "name": "platform",
          "meta": {
            "added": [
              "v0.5.0"
            ]
          },
          "desc": "<p>Returns the operating system platform. Possible values are <code>&#39;darwin&#39;</code>,\n<code>&#39;freebsd&#39;</code>, <code>&#39;linux&#39;</code>, <code>&#39;sunos&#39;</code> or <code>&#39;win32&#39;</code>. Returns the value of\n[<code>process.platform</code>][].</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.release()",
          "type": "method",
          "name": "release",
          "meta": {
            "added": [
              "v0.3.3"
            ]
          },
          "desc": "<p>Returns the operating system release.</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.tmpdir()",
          "type": "method",
          "name": "tmpdir",
          "meta": {
            "added": [
              "v0.9.9"
            ]
          },
          "desc": "<p>Returns the operating system&#39;s default directory for temporary files.</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.totalmem()",
          "type": "method",
          "name": "totalmem",
          "meta": {
            "added": [
              "v0.3.3"
            ]
          },
          "desc": "<p>Returns the total amount of system memory in bytes.</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.type()",
          "type": "method",
          "name": "type",
          "meta": {
            "added": [
              "v0.3.3"
            ]
          },
          "desc": "<p>Returns the operating system name. For example <code>&#39;Linux&#39;</code> on Linux, <code>&#39;Darwin&#39;</code>\non OS X and <code>&#39;Windows_NT&#39;</code> on Windows.</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.uptime()",
          "type": "method",
          "name": "uptime",
          "meta": {
            "added": [
              "v0.3.3"
            ]
          },
          "desc": "<p>Returns the system uptime in seconds.</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.userInfo([options])",
          "type": "method",
          "name": "userInfo",
          "meta": {
            "added": [
              "v6.0.0"
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`options` {Object} ",
                  "options": [
                    {
                      "textRaw": "`encoding` {String} Character encoding used to interpret resulting strings. If `encoding` is set to `'buffer'`, the `username`, `shell`, and `homedir` values will be `Buffer` instances. (Default: 'utf8') ",
                      "name": "encoding",
                      "default": "utf8",
                      "type": "String",
                      "desc": "Character encoding used to interpret resulting strings. If `encoding` is set to `'buffer'`, the `username`, `shell`, and `homedir` values will be `Buffer` instances."
                    }
                  ],
                  "name": "options",
                  "type": "Object",
                  "optional": true
                }
              ]
            },
            {
              "params": [
                {
                  "name": "options",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>Returns a subset of the password file entry for the current effective user. The\nreturned object includes the <code>username</code>, <code>uid</code>, <code>gid</code>, <code>shell</code>, and <code>homedir</code>.\nOn Windows, the <code>uid</code> and <code>gid</code> fields are <code>-1</code>, and <code>shell</code> is <code>null</code>.</p>\n<p>The value of <code>homedir</code> returned by <code>userInfo()</code> comes directly from the\noperating system. This differs from the result of <code>os.homedir()</code>, which queries\nseveral environment variables for the home directory before falling back to the\noperating system response.</p>\n"
        }
      ],
      "type": "module",
      "displayName": "OS"
    }
  ]
}
