get-windows-env
v0.0.3
Published
Get a list of system or user environment variables on windows
Downloads
23
Readme
get-windows-env
Get a list of system or user environment variables on windows.
Why not just process.env
?
If you want to differentiate between user and system variables this package is for you. Otherwise process.env
works just fine.
Example
See test/index.js for full examples.
import {
getUserEnv,
getSystemEnv
} from 'get-windows-env'
getSystemEnv().then(registry => console.log(registry))
/* =>
* [
* {
* name: 'TEMP',
* type: 'REG_EXPAND_SZ',
* path: '%USERPROFILE%\\AppData\\Local\\Temp'
* },
* {
* name: 'TMP',
* type: 'REG_EXPAND_SZ',
* path: '%USERPROFILE%\\AppData\\Local\\Temp'
* },
*
* ...
* ]
*/
API
#getUserEnv()
Gets all user environment variables.
#getSystemEnv()
Gets all system environment variables.
#queryRegistry(key)
Given a registry key, it returns you a matching that path.
#parseRegistry(stdout::String)
Parses a given registry string from the queryRegistry()
function to a set of key value pairs { name, type, path }
.
#keys
Object containing { user, system }
registry keys for querying the windows registry.
Tests
$ npm test