Package Exports
- ipld-resolver
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ipld-resolver) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
IPLD Resolver
JavaScript implementation of the IPLD Resolver (internal DAG API module)
Table of Contents
Install
> npm install --save ipld-resolver
Usage
const Resolver = require('ipld-resolver')
// pass an optional blockService, if no blockService is passed,
// one is created in memory.
const Resolver = new Resolver(blockService)
API
.put(node, <<cid> || <format>, <hashAlg>>, callback)
Store the given node of a recognized IPLD Format.
A CID
or a format + hashAlg tuple needs to be passed in so that the resolver understand how to serialize the object.
.get(cid [, path] [, options], callback)
Retrieve a node by the given
cid
orcid + 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 thelocalResolve
option was passed.
.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.