summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2016-04-07 13:45:40 -0400
committercjihrig <cjihrig@gmail.com>2016-04-12 17:21:29 -0400
commitd6e56fd843895356769774aebe28b0206ea86d35 (patch)
treef39bbec22b661157f70c0a44050ee006e6678385 /doc
parentaba035fb27b14fe561c45540818be6a2bbb9dc9e (diff)
downloadandroid-node-v8-d6e56fd843895356769774aebe28b0206ea86d35.tar.gz
android-node-v8-d6e56fd843895356769774aebe28b0206ea86d35.tar.bz2
android-node-v8-d6e56fd843895356769774aebe28b0206ea86d35.zip
os: add userInfo() method
os.userInfo() calls libuv's uv_os_get_passwd() function. It returns an object containing the current effective user's username, uid, gid, shell, and home directory. On Windows, the uid and gid are -1, and the shell is null. Refs: https://github.com/nodejs/node/issues/5582 PR-URL: https://github.com/nodejs/node/pull/6104 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/os.markdown16
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/api/os.markdown b/doc/api/os.markdown
index ea4f40ba79..43e71460c2 100644
--- a/doc/api/os.markdown
+++ b/doc/api/os.markdown
@@ -182,5 +182,21 @@ on OS X and `'Windows_NT'` on Windows.
Returns the system uptime in seconds.
+## os.userInfo([options])
+
+* `options` {Object}
+ * `encoding` {String} Character encoding used to interpret resulting strings.
+ If `encoding` is set to `'buffer'`, the `username`, `shell`, and `homedir`
+ values will be `Buffer` instances. (Default: 'utf8')
+
+Returns a subset of the password file entry for the current effective user. The
+returned object includes the `username`, `uid`, `gid`, `shell`, and `homedir`.
+On Windows, the `uid` and `gid` fields are `-1`, and `shell` is `null`.
+
+The value of `homedir` returned by `userInfo()` comes directly from the
+operating system. This differs from the result of `os.homedir()`, which queries
+several environment variables for the home directory before falling back to the
+operating system response.
+
[`process.arch`]: process.html#process_process_arch
[`process.platform`]: process.html#process_process_platform