Look up environment settings specific to different operating systems.
Latest commit f746b34 Jun 29, 2015 @isaacs isaacs v0.1.3
Failed to load latest commit information.
test tweak windows test skip output Jun 1, 2015
.gitignore add .gitignore May 25, 2014
.travis.yml tap 1.2.0 and travis Jun 1, 2015
LICENSE isc license May 20, 2015
README.md Add osenv.shell() Jun 18, 2012
osenv.js use `os.homedir()` polyfill for more reliable output Jun 16, 2015
package.json v0.1.3 Jun 29, 2015



Look up environment settings specific to different operating systems.


var osenv = require('osenv')
var path = osenv.path()
var user = osenv.user()
// etc.

// Some things are not reliably in the env, and have a fallback command:
var h = osenv.hostname(function (er, hostname) {
  h = hostname
// This will still cause it to be memoized, so calling osenv.hostname()
// is now an immediate operation.

// You can always send a cb, which will get called in the nextTick
// if it's been memoized, or wait for the fallback data if it wasn't
// found in the environment.
osenv.hostname(function (er, hostname) {
  if (er) console.error('error looking up hostname')
  else console.log('this machine calls itself %s', hostname)


The machine name. Calls hostname if not found.


The currently logged-in user. Calls whoami if not found.


Either PS1 on unix, or PROMPT on Windows.


The place where temporary files should be created.


No place like it.


An array of the places that the operating system will search for executables.


Return the executable name of the editor program. This uses the EDITOR and VISUAL environment variables, and falls back to vi on Unix, or notepad.exe on Windows.


The SHELL on Unix, which Windows calls the ComSpec. Defaults to 'bash' or 'cmd'.