get-windows-env

0.0.3 • Public • Published

get-windows-env

Build Status NPM version Dependency Status License Js Standard Style

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

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i get-windows-env

Weekly Downloads

4

Version

0.0.3

License

MIT

Last publish

Collaborators

  • queckezz