Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cborkit

lkwr47MIT0.1.0TypeScript support: included

A modern, extensible CBOR (Concise Binary Object Representation) library for TypeScript and JavaScript.

cbor, rfc7049, rfc8949

readme

CBOR Kit

A modern, extensible CBOR (Concise Binary Object Representation) library for TypeScript and JavaScript.

By default, CBOR Kit does not support tags and custom objects like JavaScript Maps. However, it can be easily supported by adding custom encoders and decoders. See the Advanced Usage section for more details.

Features

  • 🚀 Fast & Lightweight: Optimized encoding and decoding.
  • 🔌 Extensible: Easily add custom encoders and decoders.
  • 🎯 Customizable: Fine-tune decoding and encoding options.
  • ✅ Spec-Compliant: Adheres to RFC 8949.
  • 📦 Tree-Shakable: Bundles only the necessary code for your project.
  • 💻 TypeScript: Written in TypeScript for type safety and better DX.

Installation

# npm
npm install cborkit

# pnpm
pnpm add cborkit

# yarn
yarn add cborkit

# bun
bun add cborkit

Basic Usage

Encoding

import { encode } from "cborkit/encoder";

const data = { foo: "bar", baz: 123 };
const encoded = encode(data);

console.log(encoded); // [130, 169, 102, 111, 111, 98, 97, 114]

Decoding

import { decode } from "cborkit/decoder";

const encoded = [130, 169, 102, 111, 111, 98, 97, 114];
const decoded = decode(encoded);

console.log(decoded); // { foo: 'bar', baz: 123 }

Advanced Usage

TODO encoders / decoders plugins

TODO codec

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

changelog

Changelog

0.1.0 (2025-03-23)

Features