Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 1.14 KB

README.md

File metadata and controls

48 lines (36 loc) · 1.14 KB

winreg-promise

A promise-based wrapper around the winreg package.

This package omits the callback-based API of the original package in favor of promises.

The values returned by the promise-based API is the same as the callback-based API except that the error is thrown instead of being passed to the callback.

Installation

npm install winreg-promise

Usage

const Registry = require('winreg-promise');

const regKey = new Registry({
  hive: winreg.HKCU,
  key: '\\Software\\Microsoft\\Windows\\CurrentVersion\\Run'
});

async function get() {
  try {
    const value = await regKey.get('MyApp');
    console.log(value);
  } catch (err) {
    console.error(err);
  }
}

async function set() {
  try {
    await regKey.set('MyApp', winreg.REG_SZ, 'C:\\path\\to\\myapp.exe');
  } catch (err) {
    console.error(err);
  }
}

License

  • This repository contains code under both the MIT License and the BSD 2-Clause License.
  • The original code by Paul Bottin is licensed under the BSD 2-Clause License.
  • All other code is licensed under the MIT License.

See LICENSE for details.