You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
`multihash` is a [multihash][] which can be passed as
12
+
`multihash` is a [multihash][multihash] which can be passed as:
13
13
14
14
- Buffer, the raw Buffer of the multihash
15
15
- String, the base58 encoded version of the multihash
16
16
17
-
`callback` must follow `function (err, block) {}` signature, where `err` is an error if the operation was not successful and `block` is a [Block][].
18
-
17
+
`callback` must follow `function (err, block) {}` signature, where `err` is an error if the operation was not successful and `block` is a [Block][block] type object, containing both the data and the hash of the block.
19
18
20
19
```js
21
-
ipfs.block.get(multihash, function (err, data) {
22
-
// data is the raw data contained in a block
20
+
ipfs.block.get(multihash, function (err, block) {
21
+
if (err) {
22
+
throw err
23
+
}
24
+
console.log(block.key, block.data)
23
25
})
24
26
```
25
27
26
28
If no `callback` is passed, a promise is returned.
`multihash` is a [multihash][] which can be passed as:
55
+
`multihash` is a [multihash][multihash] which can be passed as:
63
56
64
-
- Buffer, the raw Buffer of the multihash (or of and encoded version)
65
-
- String, the toString version of the multihash (or of an encoded version)
57
+
-`Buffer`, the raw Buffer of the multihash (or of and encoded version)
58
+
-`String`, the toString version of the multihash (or of an encoded version)
66
59
67
-
`callback` must follow the signature `function (err, stats) {}`, where `err` is
68
-
an error if the operation was not successful and `stats` is an object with
69
-
the format
60
+
`callback` must follow the signature `function (err, stats) {}`, where `err` is an error if the operation was not successful and `stats` is an object with the format:`
70
61
71
62
```JavaScript
72
63
{
@@ -75,4 +66,7 @@ the format
75
66
}
76
67
```
77
68
78
-
If no `callback` is passed, a promise is returned.
69
+
If no `callback` is passed, a promise is returned.
0 commit comments