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

Commit 0498390

Browse files
author
Alan Shaw
committed
docs: update object.data API docs
1 parent 96a811e commit 0498390

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

SPEC/OBJECT.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,18 @@ A great source of [examples][] can be found in the tests for this API.
126126

127127
| Type | Description |
128128
| -------- | -------- |
129-
| `Promise<Buffer>` | A Buffer with the data that the MerkleDAG node contained |
129+
| `AsyncIterable<Buffer>` | An async iterable that yields Buffer objects with the data that the MerkleDAG node contained |
130130

131131
**Example:**
132132

133133
```JavaScript
134-
const multihash = 'QmPb5f92FxKPYdT3QNBd1GKiL4tZUXUrzF4Hkpdr3Gf1gK'
134+
const cid = 'QmPb5f92FxKPYdT3QNBd1GKiL4tZUXUrzF4Hkpdr3Gf1gK'
135135

136-
const data = await ipfs.object.data(multihash)
137-
console.log(data.toString())
138-
// Logs:
139-
// some data
136+
for await (const chunk of ipfs.object.data(cid)) {
137+
console.log(chunk.toString())
138+
// Logs:
139+
// some data
140+
}
140141
```
141142

142143
A great source of [examples][] can be found in the tests for this API.

0 commit comments

Comments
 (0)