{
  "source": "os.markdown",
  "modules": [
    {
      "textRaw": "操作系统",
      "name": "操作系统",
      "desc": "<pre><code>稳定度: 4 - 冻结</code></pre>\n<p>Provides a few basic operating-system related utility functions.\n\n</p>\n<p>提供一些基本的操作系统相关函数。\n\n</p>\n<p>Use <code>require(&apos;os&apos;)</code> to access this module.\n\n</p>\n<p>使用 <code>require(&apos;os&apos;)</code> 来调用这个模块。\n\n</p>\n",
      "methods": [
        {
          "textRaw": "os.tmpdir()",
          "type": "method",
          "name": "tmpdir",
          "desc": "<p>Returns the operating system&apos;s default directory for temp files.\n\n</p>\n<p>返回操作系统默认的临时文件目录\n\n</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.endianness()",
          "type": "method",
          "name": "endianness",
          "desc": "<p>Returns the endianness of the CPU. Possible values are <code>&quot;BE&quot;</code> or <code>&quot;LE&quot;</code>.\n\n</p>\n<p>返回 CPU 的字节序，可能的是 <code>&quot;BE&quot;</code> 或 <code>&quot;LE&quot;</code>。\n\n</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.hostname()",
          "type": "method",
          "name": "hostname",
          "desc": "<p>Returns the hostname of the operating system.\n\n</p>\n<p>返回操作系统的主机名。\n\n</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.type()",
          "type": "method",
          "name": "type",
          "desc": "<p>Returns the operating system name.\n\n</p>\n<p>返回操作系统名称。\n\n</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.platform()",
          "type": "method",
          "name": "platform",
          "desc": "<p>Returns the operating system platform.\n\n</p>\n<p>返回操作系统平台\n\n</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.arch()",
          "type": "method",
          "name": "arch",
          "desc": "<p>Returns the operating system CPU architecture. Possible values are <code>&quot;x64&quot;</code>,\n<code>&quot;arm&quot;</code> and <code>&quot;ia32&quot;</code>.\n\n</p>\n<p>返回操作系统 CPU 架构，可能的值有 <code>&quot;x64&quot;</code>、<code>&quot;arm&quot;</code> 和 <code>&quot;ia32&quot;</code>。\n\n</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.release()",
          "type": "method",
          "name": "release",
          "desc": "<p>Returns the operating system release.\n\n</p>\n<p>返回操作系统的发行版本。\n\n</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.uptime()",
          "type": "method",
          "name": "uptime",
          "desc": "<p>Returns the system uptime in seconds.\n\n</p>\n<p>返回操作系统运行的时间，以秒为单位。\n\n</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.loadavg()",
          "type": "method",
          "name": "loadavg",
          "desc": "<p>Returns an array containing the 1, 5, and 15 minute load averages.\n\n</p>\n<p>返回一个包含 1、5、15 分钟平均负载的数组。\n\n</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.totalmem()",
          "type": "method",
          "name": "totalmem",
          "desc": "<p>Returns the total amount of system memory in bytes.\n\n</p>\n<p>返回系统内存总量，单位为字节。\n\n</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.freemem()",
          "type": "method",
          "name": "freemem",
          "desc": "<p>Returns the amount of free system memory in bytes.\n\n</p>\n<p>返回操作系统空闲内存量，单位是字节。\n\n</p>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.cpus()",
          "type": "method",
          "name": "cpus",
          "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).\n\n</p>\n<p>返回一个对象数组，包含所安装的每个 CPU/内核的信息：型号、速度（单位 MHz）、时间（一个包含 user、nice、sys、idle 和 irq 所使用 CPU/内核毫秒数的对象）。\n\n</p>\n<p>Example inspection of os.cpus:\n\n</p>\n<p>os.cpus 的示例：\n\n</p>\n<pre><code>[ { model: &apos;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&apos;,\n    speed: 2926,\n    times:\n     { user: 252020,\n       nice: 0,\n       sys: 30340,\n       idle: 1070356870,\n       irq: 0 } },\n  { model: &apos;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&apos;,\n    speed: 2926,\n    times:\n     { user: 306960,\n       nice: 0,\n       sys: 26980,\n       idle: 1071569080,\n       irq: 0 } },\n  { model: &apos;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&apos;,\n    speed: 2926,\n    times:\n     { user: 248450,\n       nice: 0,\n       sys: 21750,\n       idle: 1070919370,\n       irq: 0 } },\n  { model: &apos;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&apos;,\n    speed: 2926,\n    times:\n     { user: 256880,\n       nice: 0,\n       sys: 19430,\n       idle: 1070905480,\n       irq: 20 } },\n  { model: &apos;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&apos;,\n    speed: 2926,\n    times:\n     { user: 511580,\n       nice: 20,\n       sys: 40900,\n       idle: 1070842510,\n       irq: 0 } },\n  { model: &apos;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&apos;,\n    speed: 2926,\n    times:\n     { user: 291660,\n       nice: 0,\n       sys: 34360,\n       idle: 1070888000,\n       irq: 10 } },\n  { model: &apos;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&apos;,\n    speed: 2926,\n    times:\n     { user: 308260,\n       nice: 0,\n       sys: 55410,\n       idle: 1071129970,\n       irq: 880 } },\n  { model: &apos;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&apos;,\n    speed: 2926,\n    times:\n     { user: 266450,\n       nice: 1480,\n       sys: 34920,\n       idle: 1072572010,\n       irq: 30 } } ]</code></pre>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        },
        {
          "textRaw": "os.networkInterfaces()",
          "type": "method",
          "name": "networkInterfaces",
          "desc": "<p>Get a list of network interfaces:\n\n</p>\n<p>获取网络接口的一个列表信息：\n\n</p>\n<pre><code>{ lo:\n   [ { address: &apos;127.0.0.1&apos;,\n       netmask: &apos;255.0.0.0&apos;,\n       family: &apos;IPv4&apos;,\n       mac: &apos;00:00:00:00:00:00&apos;,\n       internal: true },\n     { address: &apos;::1&apos;,\n       netmask: &apos;ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff&apos;,\n       family: &apos;IPv6&apos;,\n       mac: &apos;00:00:00:00:00:00&apos;,\n       internal: true } ],\n  eth0:\n   [ { address: &apos;192.168.1.108&apos;,\n       netmask: &apos;255.255.255.0&apos;,\n       family: &apos;IPv4&apos;,\n       mac: &apos;01:02:03:0a:0b:0c&apos;,\n       internal: false },\n     { address: &apos;fe80::a00:27ff:fe4e:66a1&apos;,\n       netmask: &apos;ffff:ffff:ffff:ffff::&apos;,\n       family: &apos;IPv6&apos;,\n       mac: &apos;01:02:03:0a:0b:0c&apos;,\n       internal: false } ] }</code></pre>\n",
          "signatures": [
            {
              "params": []
            }
          ]
        }
      ],
      "properties": [
        {
          "textRaw": "os.EOL",
          "name": "EOL",
          "desc": "<p>A constant defining the appropriate End-of-line marker for the operating system.\n\n\n</p>\n<p>一个定义了操作系统的一行结束的标识的常量。</p>\n"
        }
      ],
      "type": "module",
      "displayName": "操作系统"
    }
  ]
}