Gathering detailed insights and metrics for promise-rabbit-rpc
Gathering detailed insights and metrics for promise-rabbit-rpc
npm install promise-rabbit-rpc
Typescript
Module System
Node Version
NPM Version
58.2
Supply Chain
83.7
Quality
73.5
Maintenance
100
Vulnerability
98.6
License
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
2,321
Last Day
1
Last Week
8
Last Month
31
Last Year
145
1 Stars
60 Commits
3 Watching
1 Branches
2 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.4
Package Id
promise-rabbit-rpc@1.0.4
Size
4.46 kB
NPM Version
3.10.3
Node Version
6.4.0
Cumulative downloads
Total Downloads
Last day
-66.7%
1
Compared to previous day
Last week
0%
8
Compared to previous week
Last month
158.3%
31
Compared to previous month
Last year
-8.8%
145
Compared to previous year
Bluebird-based promise RabbitMQ RPC using amqp.node
1> npm install promise-rabbit-rpc
1const rpc = require('promise-rabbit-rpc')('amqp://localhost');
Lets write a handler, that will return the square of the number.
Note that handler can accept any number of arguments. You can use ES6 spread feature.
Function handler
is fully-fledged element of promise chain. This means that you can throw an error, or return Promise.reject(), and caller instance will recieve it.
Althoug you can return pure value or return Promise.resolve() with value - same result.
1rpc.process('sum', function handler(...numbers) {
2 if(numbers.length === 0) return Promise.reject(new Error('No numbers'));
3 return Promise.resolve(numbers.reduce((a, sum) => sum + a));
4})
Now we can call this handler from any instance. You can catch
errors like if caller and handler are executed on one nodejs process. But actually they can be located in different parts of the globe.
1rpc.promise('sum', 1, 2, 3) 2 .then( res => console.log('The sum is ', res) ) 3 .catch( reason => console.error(reason) )
If you don't want to use promise.
1rpc.call('sum', 1, 2, 3, function (err, res) { 2 console.log('The square of 99 is', res); 3}); 4
Send strings, numbers, arrays, objects or buffers. Arguments are serialized to BSON using node-buffalo.
1rpc.call('getFile', __dirname, 'getfile.js', function (err, stats, data) { 2 if (err) { 3 return console.error('Got error', err); 4 } else { 5 console.log('Got file', stats.size, data.length); 6 } 7}); 8 9rpc.handle('getFile', function (dir, filename, callback) { 10 let path = dir + '/' + filename; 11 fs.stat(path, function (err, stats) { 12 if (err) return callback(err); 13 fs.readFile(path, function (err, data) { 14 if (err) return callback(err); 15 callback(null, stats, data) 16 }); 17 }); 18});
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More