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

winreg

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

winreg - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

56

lib/registry.js

@@ -754,3 +754,3 @@ /************************************************************************************************************

*/
Registry.prototype.erase = function erase (cb) {
Registry.prototype.clear = function clear (cb) {

@@ -767,2 +767,3 @@ if (typeof cb !== 'function')

env: process.env,
stdio: [ 'ignore', 'pipe', 'pipe' ]
})

@@ -798,2 +799,55 @@ , error = null // null means no error previously reported.

/**
* Alias for the clear method to keep it backward compatible.
* @method
* @deprecated Use {@link Registry#clear} or {@link Registry#destroy} in favour of this method.
* @param {function (err)} cb - callback function
* @param {error=} cb.err - error object or null if successful
* @returns {Registry} this registry key object
*/
Registry.prototype.erase = Registry.prototype.clear;
/**
* Delete this key and all subkeys from the registry.
* @param {function (err)} cb - callback function
* @param {error=} cb.err - error object or null if successful
* @returns {Registry} this registry key object
*/
Registry.prototype.destroy = function destroy (cb) {
if (typeof cb !== 'function')
throw new TypeError('must specify a callback');
var args = ['DELETE', this.path, '/f']
, proc = spawn('REG', args, {
cwd: undefined,
env: process.env,
stdio: [ 'ignore', 'pipe', 'pipe' ]
})
, error = null // null means no error previously reported.
proc.on('close', function (code) {
if(error) {
return;
} else if (code !== 0) {
log('process exited with code ' + code);
cb(mkErrorMsg("DELETE", code, output), null);
} else {
cb(null);
}
});
proc.stdout.on('data', function (data) {
// simply discard output
log(''+data);
});
proc.on('error', function(err) {
error = err;
cb(err);
});
return this;
};
/**
* Create this registry key. Note that this is a no-op if the key already exists.

@@ -800,0 +854,0 @@ * @param {function (err)} cb - callback function

2

package.json
{
"name": "winreg",
"version": "1.0.1",
"version": "1.1.0",
"description": "provides access to the windows registry through the REG tool",

@@ -5,0 +5,0 @@ "main": "lib/registry.js",

@@ -15,2 +15,6 @@

})
, r3 = new Registry({
hive: Registry.HKCU,
key: '\\Software\\AAA_' + new Date().toISOString()
})

@@ -56,2 +60,18 @@ // get parent key

// create key
r3
. create(function (err) {
if (!err)
console.log('key created');
// delete key
r3
. destroy(function (err) {
if (!err)
console.log('key deleted');
})
})
;
})

@@ -58,0 +78,0 @@ ;

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