Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 5158b21

Browse files
committed
feat!: update docs for DAG API to match go-ipfs@0.10
1 parent 50f7ef6 commit 5158b21

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

docs/core-api/DAG.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,13 @@ An optional object which may have the following keys:
8888

8989
| Name | Type | Default | Description |
9090
| ---- | ---- | ------- | ----------- |
91-
| format | `String` | `'dag-cbor'` | The IPLD format multicodec |
91+
| storeCodec | `String` | `'dag-cbor'` | The codec that the stored object will be encoded with |
92+
| inputCodec | `String` | `undefined` | If an already encoded object is provided (as a `Uint8Array`), the codec that the object is encoded with, otherwise it is assumed the `dagNode` argument is an object to be encoded |
9293
| hashAlg | `String` | `'sha2-256'` | The hash algorithm to be used over the serialized DAG node |
9394
| cid | [CID][] | `'dag-cbor'` | The IPLD format multicodec |
9495
| pin | `boolean` | `false` | Pin this node when adding to the blockstore |
9596
| timeout | `Number` | `undefined` | A timeout in ms |
96-
| signal | [AbortSignal][] | `undefined` | Can be used to cancel any long running requests started as a result of this call |
97+
| signal | [AbortSignal][] | `undefined` | Can be used to cancel any long running requests started as a result of this call |
9798

9899
**Note**: You should pass `cid` or the `format` & `hashAlg` pair but _not both_.
99100

@@ -107,7 +108,7 @@ An optional object which may have the following keys:
107108

108109
```JavaScript
109110
const obj = { simple: 'object' }
110-
const cid = await ipfs.dag.put(obj, { format: 'dag-cbor', hashAlg: 'sha2-512' })
111+
const cid = await ipfs.dag.put(obj, { storeCodec: 'dag-cbor', hashAlg: 'sha2-512' })
111112

112113
console.log(cid.toString())
113114
// zBwWX9ecx5F4X54WAjmFLErnBT6ByfNxStr5ovowTL7AhaUR98RWvXPS1V3HqV1qs3r5Ec5ocv7eCdbqYQREXNUfYNuKG
@@ -160,7 +161,7 @@ const obj = {
160161
}
161162
}
162163

163-
const cid = await ipfs.dag.put(obj, { format: 'dag-cbor', hashAlg: 'sha2-256' })
164+
const cid = await ipfs.dag.put(obj, { storeCodec: 'dag-cbor', hashAlg: 'sha2-256' })
164165
console.log(cid.toString())
165166
// zdpuAmtur968yprkhG9N5Zxn6MFVoqAWBbhUAkNLJs2UtkTq5
166167

@@ -272,7 +273,7 @@ const obj = {
272273
}
273274
}
274275

275-
const cid = await ipfs.dag.put(obj, { format: 'dag-cbor', hashAlg: 'sha2-256' })
276+
const cid = await ipfs.dag.put(obj, { storeCodec: 'dag-cbor', hashAlg: 'sha2-256' })
276277
console.log(cid.toString())
277278
// bafyreicyer3d34cutdzlsbe2nqu5ye62mesuhwkcnl2ypdwpccrsecfmjq
278279

0 commit comments

Comments
 (0)