Intro
Installable via npm install --save ipld-dag-pb
, it can also be used directly in the browser.
Download
The source is available for download from GitHub. Alternatively, you can install using npm:
$ npm install --save ipld-dag-pb
You can then require()
ipld-dag-pb as normal:
const ipldDagPb = require('ipld-dag-pb')
In the Browser
Ipld-dag-pb should work in any ES2015 environment out of the box.
Usage:
<script type="text/javascript" src="index.js"></script>
The portable versions of ipld-dag-pb, including index.js
and index.min.js
, are included in the /dist
folder. Ipld-dag-pb can also be found on unpkg.com under
addNamedLink
Adds a link with its name as property to an object.
The link won't be added if its name is empty or matches one of the existing properties.
addEnumerableGetters
Make certain getters enumnerable
This can be used to add additional getters that are enumerable and hence
show up on an Object.keys()
call.
hidePrivateFields
Makes all properties with a leading underscore non-enumerable.
Parameters
object: Object
:The object it should be applied to
resolve
Resolves a path within a PB block.
Returns the value or a link and the partial mising path. This way the IPLD Resolver can fetch the link and continue to resolve.
Parameters
tree
Return all available paths of a block.
Parameters
binaryBlob: Buffer
:Binary representation of a PB block
cid
Calculate the CID of the binary blob.
Parameters
binaryBlob: Object
:Encoded IPLD Node
Returns
Promise<CID>