New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More β†’
Socket
Sign inDemoInstall
Socket

cborg

Package Overview
Dependencies
Maintainers
0
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cborg

Fast CBOR with a focus on strictness

  • 4.2.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
140K
increased by11.78%
Maintainers
0
Weekly downloads
Β 
Created

What is cborg?

The cborg npm package is a JavaScript implementation of the Concise Binary Object Representation (CBOR) format. It allows for encoding and decoding of data in a compact binary format, which is useful for efficient data storage and transmission.

What are cborg's main functionalities?

Encoding Data

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

const cborg = require('cborg');
const data = { hello: 'world' };
const encoded = cborg.encode(data);
console.log(encoded);

Decoding Data

This feature allows you to decode CBOR data back into JavaScript objects. The code sample demonstrates decoding a CBOR-encoded byte array back into an object.

const cborg = require('cborg');
const encoded = new Uint8Array([163, 104, 101, 108, 108, 111, 101, 119, 111, 114, 108, 100]);
const decoded = cborg.decode(encoded);
console.log(decoded);

Custom Tag Support

This feature allows you to define custom tags for encoding and decoding specific data types. The code sample demonstrates encoding an object with a custom tag.

const cborg = require('cborg');
const data = { hello: 'world' };
const encoded = cborg.encode(data, { tags: { 0: (val) => new Date(val) } });
console.log(encoded);

Other packages similar to cborg

Keywords

FAQs

Package last updated on 28 Jan 2025

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