dag-cbor-links

Usage:

Usage no npm install needed!

<script type="module">
  import dagCborLinks from 'https://cdn.skypack.dev/dag-cbor-links';
</script>

README

Get all links in a single dag-cbor node.

Usage:

let links = require('dag-cbor-links')
let cbor = require('dag-cbor-sync')()

let node = {
  mylink: {'/': 'zdpuAkv7jA671owT26AnJiFXG9usHmCAW6MTzpwFJw46X1PLG'},
  myarray: [
    {'/': 'zdpuAkv7jA671owT26AnJiFXG9usHmCAW6MTzpwFJw46X1PLG'}
  ]
}

let buffer = cbor.serialize(node)
for (let link of links(buffer)) {
  console.log(link)
  /* prints:
    ['mylink', CID(zdpuAkv7jA671owT26AnJiFXG9usHmCAW6MTzpwFJw46X1PLG)]
    ['myarray/0', CID(zdpuAkv7jA671owT26AnJiFXG9usHmCAW6MTzpwFJw46X1PLG)]
  */
}