Skip to content
Discussion options

You must be logged in to vote

It seems like there some potentially interesting things we could do here.

So to review what is possible right now: you can certainly encode a CBOR object to a byte array/buffer and then encode that into a parent object:

import { encode, decode } from 'cbor-x'
let data = {... large nested object...}
let parent = {
  key: "message1",
  data: encode(data),
}
let encoded = encode(parent);
// and then decoding:
parent = decode(encoded) // can execute pretty quickly without having to decode nested data
parent.key -> "message1"
parent.data -> encoded CBOR buffer
// I can add some data while keeping data encoded and intact
parent.meta = {...}
encode(parent)
// and if I want to decode data and acc…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PlainBane
Comment options

Answer selected by PlainBane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants