Skip to content

JavaScript Implementation of the MerkleDAG Nodes with Protobuf.

License

Notifications You must be signed in to change notification settings

Pokereum/js-ipld-dag-pb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-ipld-dag-pb

Coverage Status Travis CI Circle CI Dependency Status js-standard-style standard-readme compliant

Sauce Test Status

JavaScript Implementation of the IPLD Format MerkleDAG Node in Protobuf.

Table of Contents

Install

> npm i ipld-dag-pb

Usage

const dagPB = require('ipld-dag-pb')

// then, to access each of the components
dagPB.DAGNode
dagPB.resolver

API

DAGNode Class

Create a new DAGNode

var node = new dagPB.DAGNode([<data>, <[links]>])

addNodeLink

creates a link on node A to node B by using node B to get its multihash

addRawLink

creates a link on node A to node B by using directly node B multihash

updateNodeLink

updates a link on the node. caution this method returns a copy of the MerkleDAG node

removeNodeLink

removes a link from the node by name

removeNodeLinkByHash

removes a link from the node by the hash of the linked node

clone

creates a clone of the MerkleDAG Node

size

(property) size of the node, in bytes

links

(property) an array of DAGLinks belonging to the node

multihash(callback)

returns the multihash (default: sha2-256)

getPBNode

used internally

makeLink

used internally

DAGLink Class

Create a new DAGLink

var link = new dagPB.DAGLink(<name>, <size>, <hash>)

Local Resolver (to be used by the IPLD Resolver)

resolver.resolve

resolver.tree

resolver.patch

License

MIT © IPFS

About

JavaScript Implementation of the MerkleDAG Nodes with Protobuf.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%