Skip to content

Commit

Permalink
doc: add process api data types to documentation
Browse files Browse the repository at this point in the history
PR-URL: #9505
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Brian White <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
  • Loading branch information
imatveev authored and addaleax committed Nov 22, 2016
1 parent 7488b00 commit 77aded3
Showing 1 changed file with 56 additions and 2 deletions.
58 changes: 56 additions & 2 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@ generate a core file.
added: v0.5.0
-->

* {String}

The `process.arch` property returns a String identifying the processor
architecture that the Node.js process is currently running on. For instance
`'arm'`, `'ia32'`, or `'x64'`.
Expand All @@ -460,6 +462,8 @@ console.log(`This processor architecture is ${process.arch}`);
added: v0.1.27
-->

* {Array}

The `process.argv` property returns an array containing the command line
arguments passed when the Node.js process was launched. The first element will
be [`process.execPath`]. See `process.argv0` if access to the original value of
Expand Down Expand Up @@ -497,6 +501,8 @@ Would generate the output:
added: 6.4.0
-->

* {String}

The `process.argv0` property stores a read-only copy of the original value of
`argv[0]` passed when Node.js starts.

Expand Down Expand Up @@ -545,6 +551,8 @@ catch (err) {
added: v0.7.7
-->

* {Object}

The `process.config` property returns an Object containing the JavaScript
representation of the configure options used to compile the current Node.js
executable. This is the same as the `config.gypi` file that was produced when
Expand Down Expand Up @@ -588,6 +596,8 @@ replace the value of `process.config`.
added: v0.7.2
-->

* {Boolean}

If the Node.js process is spawned with an IPC channel (see the [Child Process][]
and [Cluster][] documentation), the `process.connected` property will return
`true` so long as the IPC channel is connected and will return `false` after
Expand All @@ -603,6 +613,9 @@ added: v6.1.0

* `previousValue` {Object} A previous return value from calling
`process.cpuUsage()`
* Return: {Object}
* `user` {Integer}
* `system` {Integer}

The `process.cpuUsage()` method returns the user and system CPU time usage of
the current process, in an object with properties `user` and `system`, whose
Expand Down Expand Up @@ -630,6 +643,8 @@ console.log(process.cpuUsage(startUsage));
added: v0.1.8
-->

* Return: {String}

The `process.cwd()` method returns the current working directory of the Node.js
process.

Expand Down Expand Up @@ -658,6 +673,8 @@ If the Node.js process was not spawned with an IPC channel,
added: v0.1.27
-->

* {Object}

The `process.env` property returns an object containing the user environment.
See environ(7).

Expand Down Expand Up @@ -822,6 +839,8 @@ emitMyWarning();
added: v0.7.7
-->

* {Object}

The `process.execArgv` property returns the set of Node.js-specific command-line
options passed when the Node.js process was launched. These options do not
appear in the array returned by the [`process.argv`][] property, and do not
Expand Down Expand Up @@ -852,13 +871,15 @@ And `process.argv`:
added: v0.1.100
-->

* {String}

The `process.execPath` property returns the absolute pathname of the executable
that started the Node.js process.

For example:

```sh
/usr/local/bin/node
```js
'/usr/local/bin/node'
```


Expand Down Expand Up @@ -931,6 +952,8 @@ is safer than calling `process.exit()`.
added: v0.11.8
-->

* {Integer}

A number which will be the process exit code, when the process either
exits gracefully, or is exited via [`process.exit()`][] without specifying
a code.
Expand Down Expand Up @@ -961,6 +984,8 @@ or Android)
added: v2.0.0
-->

* Return: {Object}

The `process.geteuid()` method returns the numerical effective user identity of
the process. (See geteuid(2).)

Expand All @@ -978,6 +1003,8 @@ Android)
added: v0.1.31
-->

* Return: {Object}

The `process.getgid()` method returns the numerical group identity of the
process. (See getgid(2).)

Expand All @@ -996,6 +1023,8 @@ Android)
added: v0.9.4
-->

* Return: {Array}

The `process.getgroups()` method returns an array with the supplementary group
IDs. POSIX leaves it unspecified if the effective group ID is included but
Node.js ensures it always is.
Expand All @@ -1008,6 +1037,8 @@ Android)
added: v0.1.28
-->

* Return: {Integer}

The `process.getuid()` method returns the numeric user identity of the process.
(See getuid(2).)

Expand Down Expand Up @@ -1140,6 +1171,11 @@ is no entry script.
added: v0.1.16
-->

* Return: {Object}
* `rss` {Integer}
* `heapTotal` {Integer}
* `heapUsed` {Integer}

The `process.memoryUsage()` method returns an object describing the memory usage
of the Node.js process measured in bytes.

Expand Down Expand Up @@ -1259,6 +1295,8 @@ happening, just like a `while(true);` loop.
added: v0.1.15
-->

* {Integer}

The `process.pid` property returns the PID of the process.

```js
Expand All @@ -1270,6 +1308,8 @@ console.log(`This process is pid ${process.pid}`);
added: v0.1.16
-->

* {String}

The `process.platform` property returns a string identifying the operating
system platform on which the Node.js process is running. For instance
`'darwin'`, `'freebsd'`, `'linux'`, `'sunos'` or `'win32'`
Expand Down Expand Up @@ -1471,6 +1511,8 @@ Android)

## process.stderr

* {Stream}

The `process.stderr` property returns a [Writable][] stream equivalent to or
associated with `stderr` (fd `2`).

Expand All @@ -1491,6 +1533,8 @@ on `process.stderr`, `process.stdout`, or `process.stdin`:

## process.stdin

* {Stream}

The `process.stdin` property returns a [Readable][] stream equivalent to or
associated with `stdin` (fd `0`).

Expand Down Expand Up @@ -1521,6 +1565,8 @@ must call `process.stdin.resume()` to read from it. Note also that calling

## process.stdout

* {Stream}

The `process.stdout` property returns a [Writable][] stream equivalent to or
associated with `stdout` (fd `1`).

Expand Down Expand Up @@ -1576,6 +1622,8 @@ See the [TTY][] documentation for more information.
added: v0.1.104
-->

* {String}

The `process.title` property returns the current process title (i.e. returns
the current value of `ps`). Assigning a new value to `process.title` modifies
the current value of `ps`.
Expand Down Expand Up @@ -1615,6 +1663,8 @@ console.log(
added: v0.5.0
-->

* Return: {Number}

The `process.uptime()` method returns the number of seconds the current Node.js
process has been running.

Expand All @@ -1623,6 +1673,8 @@ process has been running.
added: v0.1.3
-->

* {String}

The `process.version` property returns the Node.js version string.

```js
Expand All @@ -1634,6 +1686,8 @@ console.log(`Version: ${process.version}`);
added: v0.2.0
-->

* {Object}

The `process.versions` property returns an object listing the version strings of
Node.js and its dependencies.

Expand Down

0 comments on commit 77aded3

Please sign in to comment.