# @atcute/cbor

> lightweight DASL dCBOR42 codec library for AT Protocol

Latest version **2.3.8** (published 2026-09-24) · 0BSD license · 0 weekly downloads

## Install

```sh
npm install @atcute/cbor
pnpm add @atcute/cbor
yarn add @atcute/cbor
bun add @atcute/cbor
```

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.3.8 |
| Published | 2026-09-24 |
| First published | 2024-08-18 |
| Weekly downloads | 0 |
| License | 0BSD |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 3 |
| Unpacked size | 30.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | externdefs |
| Keywords | atproto, cbor, dasl |

## Links

- npm: https://www.npmjs.com/package/@atcute/cbor
- Repository: https://tangled.org/did:plc:pljn5qch4tgadongtc7i6qij
- npm.io page: https://npm.io/package/@atcute/cbor

## Dependencies (3)

- [@atcute/cid](https://npm.io/package/@atcute/cid.md) ^2.5.0
- [@atcute/multibase](https://npm.io/package/@atcute/multibase.md) ^1.2.5
- [@atcute/uint8array](https://npm.io/package/@atcute/uint8array.md) ^1.2.0

## Recent versions

- 2.3.8 (latest) — 2026-09-24
- 2.3.7 — 2026-09-10
- 2.3.6 — 2026-07-16
- 2.3.5 — 2026-06-29
- 2.3.4 — 2026-06-15
- 2.3.3 — 2026-05-08
- 2.3.2 — 2026-02-12
- 2.3.1 — 2026-02-10
- 2.3.0 — 2026-01-15
- 2.2.8 — 2025-11-23
- 2.2.7 — 2025-10-14
- 2.2.6 — 2025-10-09
- 2.2.5 — 2025-06-28
- 2.2.4 — 2025-05-17
- 2.2.3 — 2025-05-04
- … 17 more at https://npm.io/package/@atcute/cbor/versions

## README

# @atcute/cbor

deterministic CBOR codec for AT Protocol.

```sh
npm install @atcute/cbor
```

this library implements DASL's [DRISL][dasl-drisl] format used by AT Protocol for encoding records
and repository data.

[dasl-drisl]: https://dasl.ing/drisl.html

## usage

### encoding

```ts
import { encode } from '@atcute/cbor';

const record = {
	$type: 'app.bsky.feed.post',
	createdAt: '2024-08-18T03:18:24.000Z',
	langs: ['en'],
	text: 'hello world!',
};

const cbor = encode(record);
// -> Uint8Array(90)
```

### decoding

```ts
import { decode, decodeFirst } from '@atcute/cbor';

const record = decode(cborBytes);
// -> { $type: 'app.bsky.feed.post', ... }

// decode from a buffer containing multiple values
const [value, remainder] = decodeFirst(cborBytes);
```

## notes

- `undefined` values are omitted from maps (making it easier to construct objects)
- bytes and CID links use lazy wrappers (`BytesWrapper`, `CidLinkWrapper`) compatible with atproto's
  [lex-json][atproto-data-model] format
- use `toBytes`/`fromBytes` and `toCidLink`/`fromCidLink` to convert between lex-json and raw types
- integers must be within JavaScript's safe integer range (no bigint support)

[atproto-data-model]: https://atproto.com/specs/data-model

based on [`microcbor`](https://github.com/joeltg/microcbor).

---
_Source: https://npm.io/package/@atcute/cbor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
