Look up environment settings specific to different operating systems.
varosenv=require('osenv')varpath=osenv.path()varuser=osenv.user()// etc.// Some things are not reliably in the env, and have a fallback command:varh=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')elseconsole.log('this machine calls itself %s',hostname)})
The machine name. Callshostname
if not found.
The currently logged-in user. Callswhoami
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 forexecutables.
Return the executable name of the editor program. This uses the EDITORand VISUAL environment variables, and falls back tovi
on Unix, ornotepad.exe
on Windows.
The SHELL on Unix, which Windows calls the ComSpec. Defaults to 'bash'or 'cmd'.