Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

winreg

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

winreg

provides access to the windows registry through the REG tool

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
230K
decreased by-5.12%
Maintainers
1
Weekly downloads
 
Created

What is winreg?

The winreg npm package is a Node.js library for accessing and manipulating the Windows Registry. It allows you to read, write, and delete registry keys and values, making it useful for applications that need to interact with the Windows operating system at a low level.

What are winreg's main functionalities?

Read a registry key

This feature allows you to read a value from a specified registry key. The code sample demonstrates how to read a value named 'MyValue' from the 'HKEY_CURRENT_USER\Software\MyApp' key.

const Winreg = require('winreg');
const regKey = new Winreg({
  hive: Winreg.HKCU, // HKEY_CURRENT_USER
  key: '\Software\MyApp'
});
regKey.get('MyValue', (err, item) => {
  if (err) console.log('Error:', err);
  else console.log('Value:', item.value);
});

Write a registry key

This feature allows you to write a value to a specified registry key. The code sample demonstrates how to set a string value named 'MyValue' with the data 'MyData' in the 'HKEY_CURRENT_USER\Software\MyApp' key.

const Winreg = require('winreg');
const regKey = new Winreg({
  hive: Winreg.HKCU, // HKEY_CURRENT_USER
  key: '\Software\MyApp'
});
regKey.set('MyValue', Winreg.REG_SZ, 'MyData', (err) => {
  if (err) console.log('Error:', err);
  else console.log('Value written successfully');
});

Delete a registry key

This feature allows you to delete a value from a specified registry key. The code sample demonstrates how to remove a value named 'MyValue' from the 'HKEY_CURRENT_USER\Software\MyApp' key.

const Winreg = require('winreg');
const regKey = new Winreg({
  hive: Winreg.HKCU, // HKEY_CURRENT_USER
  key: '\Software\MyApp'
});
regKey.remove('MyValue', (err) => {
  if (err) console.log('Error:', err);
  else console.log('Value removed successfully');
});

Other packages similar to winreg

Keywords

FAQs

Package last updated on 19 Apr 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc