To inspect the contents of a CBOR file, use xxd -p filename
to print a hex dump of the file, and pipe that to cbor-diag
.
xxd -p pull-full.cbor | cbor-diag
{
"rs": ["a", "b", "c"],
"bk": 6,
"bb": h'240804404944140040810c0420c90020',
}
xxd
comes with macOS by default. cbor-diag
comes from the cbor-diag-cli Rust crate, which must be installed first using cargo install cbor-diag-cli
.
2 Likes
For all the JS/TS developers out there, what I’ve been doing so far was using the cborg
and uint8arrays
library in node:
$ node
> u = require("uint8arrays")
> cbor = require("cborg")
> cbor.decode(u.fromString("a263616765187b6568656c6c6f65776f726c64", "hex"))
{ age: 123, hello: 'world' }
You can also use @ipld/dag-cbor
in place of cborg
for CID
support.
2 Likes
And finally, for the lazy ones that can’t be bothered by typing things into the terminal, you can use this link.
https://cbor.nemo157.com/