Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
feat: add resolve func
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Dec 1, 2016
1 parent fc3f216 commit 64ba3de
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions API/dag/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
dag API
=======

> The dag API comes to replace the `object API`, it support the creation and manipulation of dag-pb object, as well as other IPLD formats (i.e dag-cbor, ethereum-block, git, etc)
#### `dag.put`

> Store an IPLD format node
Expand All @@ -9,13 +11,10 @@ dag API

##### `JavaScript` - ipfs.dag.put(dagNode, formatMulticodec, hashAlg, callback)

`dagNode` - a DAG node that follows one of the supported IPLD formats.

`formatMulticodec` - The IPLD format multicodec.

`hashAlg` - The hash algorithm to be used over the serialized dagNode.

`callback` must follow `function (err) {}` signature, where `err` is an error if the operation was not successful.
- `dagNode` - a DAG node that follows one of the supported IPLD formats.
- `formatMulticodec` - The IPLD format multicodec.
- `hashAlg` - The hash algorithm to be used over the serialized dagNode.
- `callback` must follow `function (err) {}` signature, where `err` is an error if the operation was not successful.

If no `callback` is passed, a [promise][] is returned.

Expand All @@ -27,8 +26,23 @@ If no `callback` is passed, a [promise][] is returned.

##### `JavaScript` - ipfs.object.get(cid, callback)

`cid` is a [CID][https://github.com/ipfs/js-cid] instance.
- `cid` is a [CID][https://github.com/ipfs/js-cid] instance.

`callback` must follow `function (err, dagNode) {}` signature, where `err` is an error if the operation was not successful and `dagNode` is the IPLD format DAG node retrieved.

If no `callback` is passed, a [promise][] is returned.

#### `dag.resolve`

> Resolves an IPLD path
##### `Go` **WIP**

##### `JavaScript` - ipfs.object.resolve(cid, path, callback)

- `cid` is a [CID][https://github.com/ipfs/js-cid] instance.
- `path` is a String that represents a valid path to be resolved

`callback` must follow `function (err, value) {}` signature, where `err` is an error if the operation was not successful and `value` is the value it was retrieved.

If no `callback` is passed, a [promise][] is returned.

0 comments on commit 64ba3de

Please sign in to comment.