kbyte.js
A lightweight JavaScript library for Obyte
Install
kbyte was designed to work both in the browser and in Node.js.
Node.js
To install kbyte on Node.js, open your terminal and run:
npm install kbyte
Browser
You can create an index.html file and include kbyte with:
Usage
var kbyte = ; // Init WebSocket clientvar client = 'wss://obyte.org/bb'; // Get peersclient;
Promises
You can also use kbyte with promises by promisifying kbyte with bluebird as in:
var kbyte = ;bluebird;
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:client;
License
MIT.