From d2a1a670e10aa9f6f6b0c24687523123ba6c59b5 Mon Sep 17 00:00:00 2001 From: imatvieiev Date: Mon, 7 Nov 2016 23:23:41 +0200 Subject: [PATCH] doc: add process api data types to documentation PR-URL: https://github.com/nodejs/node/pull/9505 Reviewed-By: Luigi Pinca Reviewed-By: Brian White Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: Roman Reiss --- doc/api/process.md | 58 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index e47a95a2226b9f..44417e15384d5c 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -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'`. @@ -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 @@ -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. @@ -535,6 +541,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 @@ -578,6 +586,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 @@ -593,6 +603,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 @@ -620,6 +633,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. @@ -648,6 +663,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). @@ -812,6 +829,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 @@ -842,13 +861,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' ``` @@ -921,6 +942,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. @@ -951,6 +974,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).) @@ -968,6 +993,8 @@ Android) added: v0.1.31 --> +* Return: {Object} + The `process.getgid()` method returns the numerical group identity of the process. (See getgid(2).) @@ -986,6 +1013,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. @@ -998,6 +1027,8 @@ Android) added: v0.1.28 --> +* Return: {Integer} + The `process.getuid()` method returns the numeric user identity of the process. (See getuid(2).) @@ -1130,6 +1161,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. @@ -1247,6 +1283,8 @@ happening, just like a `while(true);` loop. added: v0.1.15 --> +* {Integer} + The `process.pid` property returns the PID of the process. ```js @@ -1258,6 +1296,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'` @@ -1465,6 +1505,8 @@ Android) ## process.stderr +* {Stream} + The `process.stderr` property returns a [Writable][] stream equivalent to or associated with `stderr` (fd `2`). @@ -1485,6 +1527,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`). @@ -1515,6 +1559,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`). @@ -1570,6 +1616,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`. @@ -1609,6 +1657,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. @@ -1617,6 +1667,8 @@ process has been running. added: v0.1.3 --> +* {String} + The `process.version` property returns the Node.js version string. ```js @@ -1628,6 +1680,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.