Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
isLeaf: Boolean(source.Links.length),
length: (await ipfs.block.get(cid)).data.length,
unixfsData
}
} catch (err) {
// dag-pb but not a unixfs.
console.log(err)
}
for (let i = 0; i < source.Links.length; i++) {
await this._getGraphNodes(source.Links[i].Hash.toString(), nodeMap)
}
if (!source.Links.length) classes.push('leaf')
if (nodeData) classes.push('unixfs', nodeData.unixfsData.type)
} else if (Buffer.isBuffer(source)) {
classes.push('raw')
nodeData = { type: 'raw', isLeaf: true, length: source.length }
} else {
// TODO: What IPLD node is this? How to extract the links?
classes.push('leaf')
nodeData = { type: 'unknown', isLeaf: true }
}
nodeMap.set(cid, {
group: 'nodes',
data: { id: cid, ...nodeData },
classes
})
;(source.Links || []).forEach(link => {
nodeMap.set(cid + '->' + link.Hash, {