cbor-object
Version:
CBOR: deterministic encoder/decoder, diagnostic notation encoder/decoder, and utilities
33 lines (26 loc) • 939 B
Markdown
Core Description: https://github.com/cyberphone/CBOR.js#cborjs
```code
npm install cbor-object
```
If `cbor-object` is to be installed as a **global** package, perform the following:
```code
npm install cbor-object -g
cd "to local work directory"
npm link cbor-object
```
The above works for both CJS and MJS (ESM) applications. MJS example:
```cbor
// test.mjs
import CBOR from 'cbor-object';
let cbor = CBOR.Map()
.set(CBOR.Int(1), CBOR.Float(45.7))
.set(CBOR.Int(2), CBOR.String("Hi there!")).encode();
console.log(CBOR.toHex(cbor));
```
Copy the file https://github.com/cyberphone/CBOR.js/blob/main/src/cbor.js to your application and include it in HTML with the `<script src='...'></script>` tag.
See file https://cyberphone.github.io/CBOR.js/doc/release-notes.txt