# @iljucha/cbor

> Simple CBOR encoder/ decoder

Latest version **1.0.10** (published 2020-08-03) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.10 |
| Published | 2020-08-03 |
| First published | 2020-07-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 19.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ilja Bituzki |
| Maintainers | iljucha |
| Keywords | cbor, serialize, deserialize, json |

## Links

- npm: https://www.npmjs.com/package/@iljucha/cbor
- Repository: https://github.com/iljucha/cbor
- Homepage: https://github.com/iljucha/cbor#readme
- Issues: https://github.com/iljucha/cbor/issues
- npm.io page: https://npm.io/package/@iljucha/cbor

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.10 (latest) — 2020-08-03
- 1.0.8 — 2020-08-03
- 1.0.9 — 2020-08-02
- 1.0.7 — 2020-07-30
- 1.0.6 — 2020-07-30
- 1.0.5 — 2020-07-30
- 1.0.4 — 2020-07-30
- 1.0.3 — 2020-07-20
- 1.0.2 — 2020-07-11
- 1.0.1 — 2020-07-10
- 1.0.0 — 2020-07-10

## README

# CBOR
Simple extendable BOR encoder/ decoder.

## Supported types
* Booleans
* Strings
* Numbers (js floats)
* Array Buffer
* JSON Objects
* null
* undefined
* RegExp
* Arrays
* Map
* Set
* BigInt

## Usage
```javascript
import CBOR from "@iljucha/cbor"

var object = {
  string: "Hello",
  number: 12345,
  regexp: /World/gim,
  arr: ["string", 100, BigInt(10), /regtest/i],
  bigint: BigInt(420),
  set: new Set(["test", 3531]),
  map: new Map([["key1", 599], ["key2", "value"]])
}

var encoded = CBOR.encode(object)
var decoded = CBOR.decode(encoded)

CBOR.addEncoder(5, value => {
	// check what you want to encode + your encoder
})
CBOR.addDecoder(5, value => /** your decoder */)
```

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