Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
latest
denoland/stdUNSTABLE: Utilities for parsing and serializing Concise Binary Object Representation (CBOR)
This package works with Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun![It is unknown whether this package works with Cloudflare Workers It is unknown whether this package works with Cloudflare Workers](/logos/cloudflare-workers.svg?__frsh_c=325fc0b4951a6a64ccc59d061f4fc90aba37dcd3)
![It is unknown whether this package works with Node.js It is unknown whether this package works with Node.js](/logos/node.svg?__frsh_c=325fc0b4951a6a64ccc59d061f4fc90aba37dcd3)
![This package works with Deno This package works with Deno](/logos/deno.svg?__frsh_c=325fc0b4951a6a64ccc59d061f4fc90aba37dcd3)
![It is unknown whether this package works with Bun It is unknown whether this package works with Bun](/logos/bun.svg?__frsh_c=325fc0b4951a6a64ccc59d061f4fc90aba37dcd3)
![This package works with Browsers This package works with Browsers](/logos/browsers.svg?__frsh_c=325fc0b4951a6a64ccc59d061f4fc90aba37dcd3)
JSR Score
100%
Published
4 weeks ago (0.1.6)
Overview
Concise Binary Object Representation (CBOR) is a binary data serialisation format optimised for compactness and efficiency. It is designed to encode a wide range of data types, including integers, strings, arrays, and maps, in a space-efficient manner. RFC 8949 - Concise Binary Object Representation (CBOR) spec.
Limitations
- This implementation only supports the encoding and decoding of "Text String" keys.
- This implementation encodes decimal numbers with 64 bits. It takes no effort to figure out if the decimal can be encoded with 32 or 16 bits.
- When decoding, integers with a value below 2 ** 32 will be of type number, with all larger integers being of type bigint.
Functions and classes may have more specific limitations listed.
import { assert, assertEquals } from "@std/assert"; import { decodeCbor, encodeCbor } from "@std/cbor"; const rawMessage = "I am a raw Message!"; const encodedMessage = encodeCbor(rawMessage); const decodedMessage = decodeCbor(encodedMessage); assert(typeof decodedMessage === "string"); assertEquals(decodedMessage, rawMessage);
Built and signed on
View transparency logGitHub Actions
Add Package
deno add jsr:@std/cbor
Import symbol
import * as cbor from "@std/cbor";
---- OR ----
Import directly with a jsr specifier
import * as cbor from "jsr:@std/cbor";
Add Package
npx jsr add @std/cbor
Import symbol
import * as cbor from "@std/cbor";
Add Package
yarn dlx jsr add @std/cbor
Import symbol
import * as cbor from "@std/cbor";
Add Package
pnpm dlx jsr add @std/cbor
Import symbol
import * as cbor from "@std/cbor";
Add Package
bunx jsr add @std/cbor
Import symbol
import * as cbor from "@std/cbor";