Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kbyte

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kbyte

A lightweight JavaScript library for Obyte

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

npm Try kbyte on RunKit

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:

<script src="https://cdn.jsdelivr.net/npm/kbyte"></script>

Usage

var kbyte = require('kbyte');

// Init WebSocket client
var client = new kbyte.Client('wss://obyte.org/bb');

// Get peers
client.request('get_peers', null, function(err, result) {
  console.log(err, result);
});

See more examples

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:
client.requestAsync('get_peers', null).then(function(result) {
  console.log(result); // => ['wss://byteroll.com/bb', 'wss://byteball.fr/bb' ...]
});

License

MIT.

FAQs

Package last updated on 31 Mar 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc