node package manager

ipfs-ipld

IPFS IPLD

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

JavaScript implementation of the IPLDService

Table of Contents

Install

npm install --save ipfs-ipld

Usage

const ipfsIPLD = require('ipfs-ipld')
 
// available components 
ipfsIPLD.IPLDService
ipfsIPLD.resolve

API

resolve

Resolve IPLD paths against a given IPLDService

const node = {
  hello: {
    world: 11,
    some: 12
  }
}
const mh = ipld.multihash(ipld.marshal(node))
ipldService.add(node, (err) => {
  resolve(ipldService, `${mh}/hello/world`, (err, res) => {
  console.log(res)
  // => 11 
})

IPLDService

.put(node, cb)

Store the given node (any JavaScript object).

.putStream([cb])

Returns a sink pull-stream, to write IPLD objects to.

.get(multihash, cb)

Retrieve a node by the given multihash.

.getStream(multihash)

Returns a source pull-stream of the requested IPLD object.

.getRecursive(multihash, cb)

Retrieve a node by the given multihash and all linked nodes.

.getRecursiveStream(multihash)

Returns a source pull-stream, which emits the requested node, and all linked nodes.

.remove(multihash, cb)

Remove a node by the given multihash

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

License

MIT