Security News
UK Officials Consider Banning Ransomware Payments from Public Entities
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
dnode-promise
Advanced tools
Use promises on your dnode server.
npm install --save dnode-promise
Turns promise methods into functions with the dnode style callback function (arg, cb) {}
var dnode = require('dnode');
var dnodep = require('dnode-promise');
var server = dnode(dnodep.toDnode({
transform: function (url) {
// lame example of using promises
return Promise.resolve(s.replace(/[aeiou]{2,}/, 'oo').toUpperCase());
// returning the value directory (without Promise.resolve) would have worked as well!
},
}));
server.listen(5004);
Turns dnode methods to functions returning promises
var dnode = require('dnode');
var dnodep = require('dnode-promise');
var client = dnode.connect(5004);
client.on('remote', function (methods) {
var remote = dnodep.toPromise(methods);
remote.transform('beep')
.then(function (s) {
console.log('beep => ' + s);
client.end();
});
});
If you want to use another promise implementation as the default Promise
to be returned from the remote calls,
supply it to the second argument of the toPromise
method, example:
var BBPromise = require('bluebird');
// ...
var remote = dnodep.toPromise(methods, BBPromise);
remote.transform('beep')
.then(function (s) {
console.log('beep => ' + s);
d.end();
});
// ...
Copyright 2015 Koen Schmeets (hello@koenschmeets.nl)
This project is free software released under the MIT license: http://www.opensource.org/licenses/mit-license.php
FAQs
Helper for using promises on a dnode server
The npm package dnode-promise receives a total of 1 weekly downloads. As such, dnode-promise popularity was classified as not popular.
We found that dnode-promise demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.