Skip to main content

Bare minimum implementation for creating, parsing and formatting AT Protocol-blessed CIDv1 format

Works with
This package works with Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Browsers
JSR Score
100%
Published
2 months ago

atproto-cid

Bare minimum implementation for creating, parsing and formatting AT Protocol-blessed CIDv1 format.

// Parsing a CID string
parse('bafyreihffx5a2e7k5uwrmmgofbvzujc5cmw5h4espouwuxt3liqoflx3ee');
// -> { version: 1, code: 113, digest: { ... }, bytes: Uint8Array(36) }

// Creating a CID containing CBOR data
const cid = await create(0x71, buffer);

// Serializing CID into string
format(cid); // -> bafyrei...

Add Package

deno add @mary/atproto-cid

Import symbol

import * as mod from "@mary/atproto-cid";

Add Package

npx jsr add @mary/atproto-cid

Import symbol

import * as mod from "@mary/atproto-cid";

Add Package

yarn dlx jsr add @mary/atproto-cid

Import symbol

import * as mod from "@mary/atproto-cid";

Add Package

pnpm dlx jsr add @mary/atproto-cid

Import symbol

import * as mod from "@mary/atproto-cid";

Add Package

bunx jsr add @mary/atproto-cid

Import symbol

import * as mod from "@mary/atproto-cid";