Browse Source

doc: add return types and props types to OS module

PR-URL: https://github.com/nodejs/node/pull/9648
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
v7.x
imatvieiev 8 years ago
committed by Anna Henningsen
parent
commit
b258a70a40
No known key found for this signature in database GPG Key ID: D8B9F5AEAE84E4CF
  1. 31
      doc/api/os.md

31
doc/api/os.md

@ -14,6 +14,8 @@ const os = require('os');
added: v0.7.8 added: v0.7.8
--> -->
* {String}
A string constant defining the operating system-specific end-of-line marker: A string constant defining the operating system-specific end-of-line marker:
* `\n` on POSIX * `\n` on POSIX
@ -35,6 +37,8 @@ Equivalent to [`process.arch`][].
## os.constants ## os.constants
* {Object}
Returns an object containing commonly used operating system specific constants Returns an object containing commonly used operating system specific constants
for error codes, process signals, and so on. The specific constants currently for error codes, process signals, and so on. The specific constants currently
defined are described in [OS Constants][]. defined are described in [OS Constants][].
@ -44,6 +48,8 @@ defined are described in [OS Constants][].
added: v0.3.3 added: v0.3.3
--> -->
* Returns: {Array}
The `os.cpus()` method returns an array of objects containing information about The `os.cpus()` method returns an array of objects containing information about
each CPU/core installed. each CPU/core installed.
@ -161,6 +167,8 @@ all processors are always 0.
added: v0.9.4 added: v0.9.4
--> -->
* Returns: {String}
The `os.endianness()` method returns a string identifying the endianness of the The `os.endianness()` method returns a string identifying the endianness of the
CPU *for which the Node.js binary was compiled*. CPU *for which the Node.js binary was compiled*.
@ -174,6 +182,8 @@ Possible values are:
added: v0.3.3 added: v0.3.3
--> -->
* Returns: {Integer}
The `os.freemem()` method returns the amount of free system memory in bytes as The `os.freemem()` method returns the amount of free system memory in bytes as
an integer. an integer.
@ -182,6 +192,8 @@ an integer.
added: v2.3.0 added: v2.3.0
--> -->
* Returns: {String}
The `os.homedir()` method returns the home directory of the current user as a The `os.homedir()` method returns the home directory of the current user as a
string. string.
@ -190,6 +202,8 @@ string.
added: v0.3.3 added: v0.3.3
--> -->
* Returns: {String}
The `os.hostname()` method returns the hostname of the operating system as a The `os.hostname()` method returns the hostname of the operating system as a
string. string.
@ -198,6 +212,8 @@ string.
added: v0.3.3 added: v0.3.3
--> -->
* Returns: {Array}
The `os.loadavg()` method returns an array containing the 1, 5, and 15 minute The `os.loadavg()` method returns an array containing the 1, 5, and 15 minute
load averages. load averages.
@ -213,6 +229,8 @@ Windows platforms. On Windows, the return value is always `[0, 0, 0]`.
added: v0.6.0 added: v0.6.0
--> -->
* Returns: {Object}
The `os.networkInterfaces()` method returns an object containing only network The `os.networkInterfaces()` method returns an object containing only network
interfaces that have been assigned a network address. interfaces that have been assigned a network address.
@ -272,6 +290,8 @@ The properties available on the assigned network address object include:
added: v0.5.0 added: v0.5.0
--> -->
* Returns: {String}
The `os.platform()` method returns a string identifying the operating system The `os.platform()` method returns a string identifying the operating system
platform as set during compile time of Node.js. platform as set during compile time of Node.js.
@ -296,6 +316,8 @@ to be experimental at this time.
added: v0.3.3 added: v0.3.3
--> -->
* Returns: {String}
The `os.release()` method returns a string identifying the operating system The `os.release()` method returns a string identifying the operating system
release. release.
@ -308,6 +330,8 @@ https://en.wikipedia.org/wiki/Uname#Examples for more information.
added: v0.9.9 added: v0.9.9
--> -->
* Returns: {String}
The `os.tmpdir()` method returns a string specifying the operating system's The `os.tmpdir()` method returns a string specifying the operating system's
default directory for temporary files. default directory for temporary files.
@ -316,6 +340,8 @@ default directory for temporary files.
added: v0.3.3 added: v0.3.3
--> -->
* Returns: {Integer}
The `os.totalmem()` method returns the total amount of system memory in bytes The `os.totalmem()` method returns the total amount of system memory in bytes
as an integer. as an integer.
@ -324,6 +350,8 @@ as an integer.
added: v0.3.3 added: v0.3.3
--> -->
* Returns: {String}
The `os.type()` method returns a string identifying the operating system name The `os.type()` method returns a string identifying the operating system name
as returned by uname(3). For example `'Linux'` on Linux, `'Darwin'` on OS X and as returned by uname(3). For example `'Linux'` on Linux, `'Darwin'` on OS X and
`'Windows_NT'` on Windows. `'Windows_NT'` on Windows.
@ -336,6 +364,8 @@ information about the output of running uname(3) on various operating systems.
added: v0.3.3 added: v0.3.3
--> -->
* Returns: {Integer}
The `os.uptime()` method returns the system uptime in number of seconds. The `os.uptime()` method returns the system uptime in number of seconds.
*Note*: Within Node.js' internals, this number is represented as a `double`. *Note*: Within Node.js' internals, this number is represented as a `double`.
@ -351,6 +381,7 @@ added: v6.0.0
* `encoding` {String} Character encoding used to interpret resulting strings. * `encoding` {String} Character encoding used to interpret resulting strings.
If `encoding` is set to `'buffer'`, the `username`, `shell`, and `homedir` If `encoding` is set to `'buffer'`, the `username`, `shell`, and `homedir`
values will be `Buffer` instances. (Default: 'utf8') values will be `Buffer` instances. (Default: 'utf8')
* Returns: {Object}
The `os.userInfo()` method returns information about the currently effective The `os.userInfo()` method returns information about the currently effective
user -- on POSIX platforms, this is typically a subset of the password file. The user -- on POSIX platforms, this is typically a subset of the password file. The

Loading…
Cancel
Save