Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
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 11 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
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.