Sophie

Sophie

distrib > Fedora > 20 > x86_64 > by-pkgid > e5c70986696a0e6199e6350dcdb03a8d > files > 74

nodejs-docs-0.10.32-1.fc20.noarch.rpm

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>os Node.js v0.10.32 Manual &amp; Documentation</title>
  <link rel="stylesheet" href="assets/style.css">
  <link rel="stylesheet" href="assets/sh.css">
  <link rel="canonical" href="http://nodejs.org/api/os.html">
</head>
<body class="alt apidoc" id="api-section-os">
    <div id="intro" class="interior">
        <a href="/" title="Go back to the home page">
            <img id="logo" src="http://nodejs.org/images/logo-light.png" alt="node.js">
        </a>
    </div>
    <div id="content" class="clearfix">
        <div id="column2" class="interior">
            <ul>
                <li><a href="/" class="home">Home</a></li>
                <li><a href="/download/" class="download">Download</a></li>
                <li><a href="/about/" class="about">About</a></li>
                <li><a href="http://npmjs.org/" class="npm">npm Registry</a></li>
                <li><a href="http://nodejs.org/api/" class="docs current">Docs</a></li>
                <li><a href="http://blog.nodejs.org" class="blog">Blog</a></li>
                <li><a href="/community/" class="community">Community</a></li>
                <li><a href="/logos/" class="logos">Logos</a></li>
                <li><a href="http://jobs.nodejs.org/" class="jobs">Jobs</a></li>
            </ul>
            <p class="twitter"><a href="http://twitter.com/nodejs">@nodejs</a></p>
        </div>

        <div id="column1" class="interior">
          <header>
            <h1>Node.js v0.10.32 Manual &amp; Documentation</h1>
            <div id="gtoc">
              <p>
                <a href="index.html" name="toc">Index</a> |
                <a href="all.html">View on single page</a> |
                <a href="os.json">View as JSON</a>
              </p>
            </div>
            <hr>
          </header>

          <div id="toc">
            <h2>Table of Contents</h2>
            <ul>
<li><a href="#os_os">os</a><ul>
<li><a href="#os_os_tmpdir">os.tmpdir()</a></li>
<li><a href="#os_os_endianness">os.endianness()</a></li>
<li><a href="#os_os_hostname">os.hostname()</a></li>
<li><a href="#os_os_type">os.type()</a></li>
<li><a href="#os_os_platform">os.platform()</a></li>
<li><a href="#os_os_arch">os.arch()</a></li>
<li><a href="#os_os_release">os.release()</a></li>
<li><a href="#os_os_uptime">os.uptime()</a></li>
<li><a href="#os_os_loadavg">os.loadavg()</a></li>
<li><a href="#os_os_totalmem">os.totalmem()</a></li>
<li><a href="#os_os_freemem">os.freemem()</a></li>
<li><a href="#os_os_cpus">os.cpus()</a></li>
<li><a href="#os_os_networkinterfaces">os.networkInterfaces()</a></li>
<li><a href="#os_os_eol">os.EOL</a></li>
</ul>
</li>
</ul>

          </div>

          <div id="apicontent">
            <h1>os<span><a class="mark" href="#os_os" id="os_os">#</a></span></h1>
<pre class="api_stability_4">Stability: 4 - API Frozen</pre><p>Provides a few basic operating-system related utility functions.

</p>
<p>Use <code>require(&#39;os&#39;)</code> to access this module.

</p>
<h2>os.tmpdir()<span><a class="mark" href="#os_os_tmpdir" id="os_os_tmpdir">#</a></span></h2>
<p>Returns the operating system&#39;s default directory for temp files.

</p>
<h2>os.endianness()<span><a class="mark" href="#os_os_endianness" id="os_os_endianness">#</a></span></h2>
<p>Returns the endianness of the CPU. Possible values are <code>&quot;BE&quot;</code> or <code>&quot;LE&quot;</code>.

</p>
<h2>os.hostname()<span><a class="mark" href="#os_os_hostname" id="os_os_hostname">#</a></span></h2>
<p>Returns the hostname of the operating system.

</p>
<h2>os.type()<span><a class="mark" href="#os_os_type" id="os_os_type">#</a></span></h2>
<p>Returns the operating system name.

</p>
<h2>os.platform()<span><a class="mark" href="#os_os_platform" id="os_os_platform">#</a></span></h2>
<p>Returns the operating system platform.

</p>
<h2>os.arch()<span><a class="mark" href="#os_os_arch" id="os_os_arch">#</a></span></h2>
<p>Returns the operating system CPU architecture.

</p>
<h2>os.release()<span><a class="mark" href="#os_os_release" id="os_os_release">#</a></span></h2>
<p>Returns the operating system release.

</p>
<h2>os.uptime()<span><a class="mark" href="#os_os_uptime" id="os_os_uptime">#</a></span></h2>
<p>Returns the system uptime in seconds.

</p>
<h2>os.loadavg()<span><a class="mark" href="#os_os_loadavg" id="os_os_loadavg">#</a></span></h2>
<p>Returns an array containing the 1, 5, and 15 minute load averages.

</p>
<p>The load average is a measure of system activity, calculated by the operating
system and expressed as a fractional number.  As a rule of thumb, the load
average should ideally be less than the number of logical CPUs in the system.

</p>
<p>The load average is a very UNIX-y concept; there is no real equivalent on
Windows platforms.  That is why this function always returns <code>[0, 0, 0]</code> on
Windows.

</p>
<h2>os.totalmem()<span><a class="mark" href="#os_os_totalmem" id="os_os_totalmem">#</a></span></h2>
<p>Returns the total amount of system memory in bytes.

</p>
<h2>os.freemem()<span><a class="mark" href="#os_os_freemem" id="os_os_freemem">#</a></span></h2>
<p>Returns the amount of free system memory in bytes.

</p>
<h2>os.cpus()<span><a class="mark" href="#os_os_cpus" id="os_os_cpus">#</a></span></h2>
<p>Returns an array of objects containing information about each CPU/core
installed: model, speed (in MHz), and times (an object containing the number of
milliseconds the CPU/core spent in: user, nice, sys, idle, and irq).

</p>
<p>Example inspection of os.cpus:

</p>
<pre><code>[ { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,
    speed: 2926,
    times:
     { user: 252020,
       nice: 0,
       sys: 30340,
       idle: 1070356870,
       irq: 0 } },
  { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,
    speed: 2926,
    times:
     { user: 306960,
       nice: 0,
       sys: 26980,
       idle: 1071569080,
       irq: 0 } },
  { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,
    speed: 2926,
    times:
     { user: 248450,
       nice: 0,
       sys: 21750,
       idle: 1070919370,
       irq: 0 } },
  { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,
    speed: 2926,
    times:
     { user: 256880,
       nice: 0,
       sys: 19430,
       idle: 1070905480,
       irq: 20 } },
  { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,
    speed: 2926,
    times:
     { user: 511580,
       nice: 20,
       sys: 40900,
       idle: 1070842510,
       irq: 0 } },
  { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,
    speed: 2926,
    times:
     { user: 291660,
       nice: 0,
       sys: 34360,
       idle: 1070888000,
       irq: 10 } },
  { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,
    speed: 2926,
    times:
     { user: 308260,
       nice: 0,
       sys: 55410,
       idle: 1071129970,
       irq: 880 } },
  { model: &#39;Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz&#39;,
    speed: 2926,
    times:
     { user: 266450,
       nice: 1480,
       sys: 34920,
       idle: 1072572010,
       irq: 30 } } ]</code></pre>
<h2>os.networkInterfaces()<span><a class="mark" href="#os_os_networkinterfaces" id="os_os_networkinterfaces">#</a></span></h2>
<p>Get a list of network interfaces:

</p>
<pre><code>{ lo0: 
   [ { address: &#39;::1&#39;, family: &#39;IPv6&#39;, internal: true },
     { address: &#39;fe80::1&#39;, family: &#39;IPv6&#39;, internal: true },
     { address: &#39;127.0.0.1&#39;, family: &#39;IPv4&#39;, internal: true } ],
  en1: 
   [ { address: &#39;fe80::cabc:c8ff:feef:f996&#39;, family: &#39;IPv6&#39;,
       internal: false },
     { address: &#39;10.0.1.123&#39;, family: &#39;IPv4&#39;, internal: false } ],
  vmnet1: [ { address: &#39;10.99.99.254&#39;, family: &#39;IPv4&#39;, internal: false } ],
  vmnet8: [ { address: &#39;10.88.88.1&#39;, family: &#39;IPv4&#39;, internal: false } ],
  ppp0: [ { address: &#39;10.2.0.231&#39;, family: &#39;IPv4&#39;, internal: false } ] }</code></pre>
<h2>os.EOL<span><a class="mark" href="#os_os_eol" id="os_os_eol">#</a></span></h2>
<p>A constant defining the appropriate End-of-line marker for the operating system.
</p>

          </div>
        </div>
    </div>
    <div id="footer">
        <a href="http://joyent.com" class="joyent-logo">Joyent</a>
        <ul class="clearfix">
            <li><a href="/">Node.js</a></li>
            <li><a href="/download/">Download</a></li>
            <li><a href="/about/">About</a></li>
            <li><a href="http://npmjs.org/">npm Registry</a></li>
            <li><a href="http://nodejs.org/api/">Docs</a></li>
            <li><a href="http://blog.nodejs.org">Blog</a></li>
            <li><a href="/community/">Community</a></li>
            <li><a href="/logos/">Logos</a></li>
            <li><a href="http://jobs.nodejs.org/">Jobs</a></li>
            <li><a href="http://twitter.com/nodejs" class="twitter">@nodejs</a></li>
        </ul>

        <p>Copyright <a href="http://joyent.com/">Joyent, Inc</a>, Node.js is a <a href="/trademark-policy.pdf">trademark</a> of Joyent, Inc. View <a href="https://raw.github.com/joyent/node/v0.10.32/LICENSE">license</a>.</p>
    </div>

  <script src="../sh_main.js"></script>
  <script src="../sh_javascript.min.js"></script>
  <script>highlight(undefined, undefined, 'pre');</script>
  <script>
    window._gaq = [['_setAccount', 'UA-10874194-2'], ['_trackPageview']];
    (function(d, t) {
      var g = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      g.src = '//www.google-analytics.com/ga.js';
      s.parentNode.insertBefore(g, s);
    }(document, 'script'));
  </script>
</body>
</html>