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 Feb 12, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/core-api/BLOCK.md
+6-20
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,7 @@ An optional object which may have the following keys:
39
39
| ---- | ---- | ------- | ----------- |
40
40
| timeout |`Number`|`undefined`| A timeout in ms |
41
41
| signal |[AbortSignal][]|`undefined`| Can be used to cancel any long running requests started as a result of this call |
42
+
| preload |`boolean`|`false`| Whether to preload all blocks created during this operation |
42
43
43
44
### Returns
44
45
@@ -63,7 +64,7 @@ A great source of [examples][] can be found in the tests for this API.
63
64
64
65
| Name | Type | Description |
65
66
| ---- | ---- | ----------- |
66
-
| block |A `Uint8Array`or [Block][] instance | The block or data to store |
67
+
| block |`Uint8Array`| The block of data to store |
67
68
68
69
### Options
69
70
@@ -73,19 +74,18 @@ An optional object which may have the following keys:
73
74
| ---- | ---- | ------- | ----------- |
74
75
| format |`String`|`'dag-pb'`| The codec to use to create the CID |
75
76
| mhtype |`String`|`sha2-256`| The hashing algorithm to use to create the CID |
76
-
| mhlen |`Number`|||
77
+
| mhlen |`Number`|`undefined`| The hash length (only relevant for `go-ipfs`)|
77
78
| version |`Number`|`0`| The version to use to create the CID |
78
79
| pin |`boolean`|`false`| If true, pin added blocks recursively |
79
80
| timeout |`Number`|`undefined`| A timeout in ms |
80
81
| signal |[AbortSignal][]|`undefined`| Can be used to cancel any long running requests started as a result of this call |
81
-
82
-
**Note:** If you pass a [`Block`][block] instance as the block parameter, you don't need to pass options, as the block instance will carry the CID value as a property.
82
+
| preload |`boolean`|`false`| Whether to preload all blocks created during this operation |
83
83
84
84
### Returns
85
85
86
86
| Type | Description |
87
87
| -------- | -------- |
88
-
|`Promise<Block>`| A [Block][block] type object, containing both the data and the hash of the block |
88
+
|`Promise<CID>`| A [CID][CID] type object containing the hash of the block |
89
89
90
90
### Example
91
91
@@ -96,21 +96,6 @@ const decoder = new TextDecoder()
0 commit comments