env

An object containing the user environment. See environ(7). Here is an example environment printout:

$ node doc_test.js
{ TERM_PROGRAM: 'Apple_Terminal',
  TERM: 'xterm-color',
  SHELL: '/bin/bash',
  TERM_PROGRAM_VERSION: '273.1',
  USER: 'johndoe',
  COMMAND_MODE: 'unix2003',
  __CF_USER_TEXT_ENCODING: '0x1F5:0:0',
  PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/opt/local/bin',
  PWD: '/Users/johndoe',
  LANG: 'en_US.UTF-8',
  SHLVL: '1',
  HOME: '/Users/johndoe/,
  LOGNAME: 'johndoe',
  DISPLAY: '/tmp/launch-UwKKrv/org.x:0',
  _: '/usr/local/bin/node',
  OLDPWD: '/Users/johndoe }

An example of using env to access the TERM environment variable:

console.log(process.env.TERM);
$ node doc_test.js
xterm-color

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s