Encode and parse data in the Concise Binary Object Representation (CBOR) data format (RFC7049).
npm install fast-cbor






> Encode and parse data in the Concise Binary Object Representation (CBOR) data format (RFC7049) as fast as possible.
This library is a fork of the awesome node-cbor](https://github.com/RichardLitt/standard-readme)
). It borrows a lot of the interface, but drops all streaming and async processing in favor of a minimal syn api and being as fast as possible.
``bash`
$ npm install --save fast-cbor
TODO
`javascript
const cbor = require('cbor')
const assert = require('assert')
const encoded = cbor.encode(true) // returns
const decoded = cbor.decodeFirst(encoded)
// decoded is the unpacked object
assert.ok(obj === true);
// Use integers as keys?
var m = new Map();
m.set(1, 2);
encoded = cbor.encode(m); //
`
The sync encoding and decoding are exported as a
leveldb encoding, as
cbor.leveldb`.
The following types are supported for encoding:
* boolean
* number (including -0, NaN, and ±Infinity)
* string
* Array, Set (encoded as Array)
* Object (including null), Map
* undefined
* Buffer
* Date,
* RegExp
* url.URL
* bignumber
Decoding supports the above types, including the following CBOR tag numbers:
| Tag | Generated Type |
|-----|----------------|
| 0 | Date |
| 1 | Date |
| 2 | bignumber |
| 3 | bignumber |
| 4 | bignumber |
| 5 | bignumber |
| 32 | url.URL |
| 35 | RegExp |
TODO
TODO
TODO