🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

borc

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

borc

Encode and parse data in the Concise Binary Object Representation (CBOR) data format (RFC7049).

3.0.0
latest
Source
npm
Version published
Weekly downloads
218K
63.04%
Maintainers
3
Weekly downloads
 
Created

What is borc?

The 'borc' npm package is a JavaScript library for encoding and decoding data in the CBOR (Concise Binary Object Representation) format. CBOR is a binary data serialization format similar to JSON but more compact, making it suitable for data exchange in constrained environments.

What are borc's main functionalities?

Encoding Data to CBOR

This feature allows you to encode JavaScript objects into the CBOR format. The code sample demonstrates encoding a simple object with a key-value pair into CBOR.

const cbor = require('borc');
const encoded = cbor.encode({ key: 'value' });
console.log(encoded);

Decoding CBOR Data

This feature allows you to decode CBOR data back into JavaScript objects. The code sample shows how to decode previously encoded CBOR data back into its original object form.

const cbor = require('borc');
const encoded = cbor.encode({ key: 'value' });
const decoded = cbor.decode(encoded);
console.log(decoded);

Streaming Decoding

This feature provides the ability to decode CBOR data from a stream, which is useful for processing large datasets or data received over a network. The code sample demonstrates setting up a stream decoder and processing encoded data.

const cbor = require('borc');
const { Decoder } = cbor;
const decoder = new Decoder();
decoder.on('data', (data) => console.log(data));
decoder.write(cbor.encode({ key: 'value' }));

Other packages similar to borc

Keywords

coap

FAQs

Package last updated on 27 Apr 2021

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