kbyte
Search…
⌃K
Links

Promises

You can also use kbyte with promises by promisifying kbyte with bluebird as in:
var kbyte = require('kbyte');
bluebird.promisifyAll(kbyte.Client.prototype);
It'll add a Async to all kbyte functions (e.g. return client.requestAsync().then()) client.request('get_peers', null, function(err, result) { console.log(err, result); });
// So instead of writing client.request('get_peers', null, cb); you have to write:
return client.requestAsync('get_peers', null).then(function(result) {
console.log(result); // => ['wss://byteroll.com/bb', 'wss://byteball.fr/bb' ...]
});
Last modified 4yr ago