1.1.0 • Published 8 years ago
register-protocol-win32 v1.1.0
register-protocol-win32
Register a custom protocol (ie. myapp://) on Windows.
Install
Install via npm
npm install register-protocol-win32Documentation
install(protocol, command, options)(promise) - Creates a new, or updates if existing, protocol in the Windows registry. Returns a promise.protocol(string required) - The name of the protocol you want to register, example:myappcommand(string required) - The command that will be executed when your protocol is run, example:"C:\\Program Files\\myapp.exe" "%1" "%2"options(object optional) -allUsers(boolean) - Iftruecreates protocol in HKEY_LOCAL_MACHINE (requires administrator privileges) otherwise creates in HKEY_CURRENT_USERicon(string) - The path to the icon, example:C:\\Program Files\\myapp.exe,1}
uninstall(protocol, options)(promise) - Removes the specified protocol from the Windows registry. Returns a promise.protocol(string required) - The name of the protocol to remove, example: myappoptions(object optional)allUsers(boolean) - Iftrueremoves protocol from HKEY_LOCAL_MACHINE (requires administrator privileges) otherwise removes from HKEY_CURRENT_USER
exists(protocol, options)(promise) - Determines if the protocol key exists in the registry. Returns a promise.protocol(string required) - The name of the protocol to remove, example: myappoptions(object optional)allUsers(boolean) - Iftruechecks HKEY_LOCAL_MACHINE (requires administrator privileges) otherwise checks HKEY_CURRENT_USER
Usage
var protocol = require('register-protocol-win32');
protocol.install('myapp', '"C:\\myapp.exe" "%1"')
.then(function() {
// Success
})
.catch(function(err) {
// Failed
});
protocol.uninstall('myapp')
.then(function() {
// Success
})
.catch(function(err) {
// Failed
});
protocol.exists('myapp')
.then(function(exists) {
// exists will be true or false
})
.catch(function(err) {
// Failed
})Tests
Run via npm
npm testAttribution
This library is based in part by work done on WebTorrent Desktop by Feross Aboukhadijeh.
License
MIT. Copyright (c) Denny Ferrassoli