ipld-resolver v0.14.1
IPLD Resolver
JavaScript implementation of the IPLD Resolver (internal DAG API module)
Table of Contents
Install
> npm install --save ipld-resolverUsage
const Resolver = require('ipld-resolver')
// You need to create and pass an ipfs-block-service instance
// https://github.com/ipfs/js-ipfs-block-service
const Resolver = new Resolver(<ipfs-block-service instance>)API
.put(node, options, callback)
Store the given node of a recognized IPLD Format.
options is an object that must contain one of the following combinations:
cid- the CID of the nodehashAlgandformat- the hashAlg and the format that should be used to create the CID of the node
callback is a function that should have the signature as following: function (err, cid) {}, where err is an Error object in case of error and cid is the cid of the stored object.
.get(cid [, path] [, options], callback)
Retrieve a node by the given
cidorcid + path
options is an optional object containing:
localResolve: bool- if true, get will only attempt to resolve the path locally
callback should be a function with the signature function (err, result), the result being an object with:
value- the value that resulted from the getremainderPath- If it didn't manage to successfully resolve the whole path through or if simply thelocalResolveoption was passed.
.getStream(cid [, path] [, options])
Same as get, but returns a source pull-stream that is used to pass the fetched node.
.treeStream(cid [, path] [, options])
Returns all the paths under a cid + path through a pull-stream. Accepts the following options:
recursive- bool - traverse through links to complete the graph.
.remove(cid, callback)
Remove a node by the given
cid
.support.add(multicodec, formatResolver, formatUtil)
Add support to another IPLD Format
.support.rm(multicodec)
Removes support of an IPLD Format
Contribute
Feel free to join in. All welcome. Open an issue!
This repository falls under the IPFS Code of Conduct.
License
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
