1.0.0 • Published 10 months ago

@oslojs/cbor v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@oslojs/cbor

Documentation: https://cbor.oslojs.dev

A CBOR library for JavaScript based on RFC 8949.

  • Runtime agnostic
  • No third-party dependencies
  • Fully typed
import { decodeCBORToNativeValueNoLeftoverBytes } from "@oslojs/cbor";

const MAX_DEPTH = 10;
const encoded = new Uint8Array([
	0xa1, 0x67, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x65, 0x68, 0x65, 0x6c, 0x6c, 0x6f
]);
const result = decodeCBORToNativeValueNoLeftoverBytes(encoded, MAX_DEPTH) as Result;
const message: string = result.message;

interface Result {
	message: string;
}

This package currently only supports decoding

Installation

npm i @oslojs/cbor
1.0.0

10 months ago

0.2.2

12 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago