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 Aug 12, 2020. It is now read-only.
The importer is a object Transform stream that accepts objects of the form
109
+
The `import` object is a duplex pull stream that takes objects of the form:
105
110
106
111
```js
107
112
{
@@ -110,50 +115,50 @@ The importer is a object Transform stream that accepts objects of the form
110
115
}
111
116
```
112
117
113
-
The stream will output IPFS DAG Node stats for the nodes as they are added to
114
-
the DAG Service. When stats on a node are emitted they are guaranteed to have
115
-
been written into the [DAG Service][]'s storage mechanism.
118
+
`import` will outoyt file info objects as files get stored in IPFS. When stats on a node are emitted they are guaranteed to have been written.
116
119
117
-
The input's file paths and directory structure will be preserved in the DAG
118
-
Nodes.
120
+
`dag` is an instance of the [`IPLD Resolver`](https://github.com/ipld/js-ipld-resolver) or the [`js-ipfs``dag api`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/dag)
119
121
120
-
### Importer options
122
+
The input's file paths and directory structure will be preserved in the [`dag-pb`](https://github.com/ipld/js-ipld-dag-pb) created nodes.
121
123
122
-
In the second argument of the importer constructor you can specify the following options:
124
+
`options` is an JavaScript option that might include the following keys:
123
125
124
-
*`wrap` (boolean, defaults to false): if true, a wrapping node will be created
125
-
*`shardSplitThreshold` (positive integer, defaults to 1000): the number of directory entries above which we decide to use a sharding directory builder (instead of the default flat one)
126
-
*`chunker` (string, defaults to `"fixed"`): the chunking strategy. Now only supports `"fixed"`
127
-
*`chunkerOptions` (object, optional): the options for the chunker. Defaults to an object with the following properties:
128
-
*`maxChunkSize` (positive integer, defaults to `262144`): the maximum chunk size for the `fixed` chunker.
129
-
*`strategy` (string, defaults to `"balanced"`): the DAG builder strategy name. Supports:
*`maxChildrenPerNode` (positive integer, defaults to `174`): the maximum children per node for the `balanced` and `trickle` DAG builder strategies
134
-
*`layerRepeat` (positive integer, defaults to 4): (only applicable to the `trickle` DAG builder strategy). The maximum repetition of parent nodes for each layer of the tree.
135
-
*`reduceSingleLeafToSelf` (boolean, defaults to `false`): optimization for, when reducing a set of nodes with one node, reduce it to that node.
136
-
*`dirBuilder` (object): the options for the directory builder
137
-
*`hamt` (object): the options for the HAMT sharded directory builder
138
-
* bits (positive integer, defaults to `5`): the number of bits at each bucket of the HAMT
126
+
-`wrap` (boolean, defaults to false): if true, a wrapping node will be created
127
+
-`shardSplitThreshold` (positive integer, defaults to 1000): the number of directory entries above which we decide to use a sharding directory builder (instead of the default flat one)
128
+
-`chunker` (string, defaults to `"fixed"`): the chunking strategy. Now only supports `"fixed"`
129
+
-`chunkerOptions` (object, optional): the options for the chunker. Defaults to an object with the following properties:
130
+
-`maxChunkSize` (positive integer, defaults to `262144`): the maximum chunk size for the `fixed` chunker.
131
+
-`strategy` (string, defaults to `"balanced"`): the DAG builder strategy name. Supports:
-`maxChildrenPerNode` (positive integer, defaults to `174`): the maximum children per node for the `balanced` and `trickle` DAG builder strategies
136
+
-`layerRepeat` (positive integer, defaults to 4): (only applicable to the `trickle` DAG builder strategy). The maximum repetition of parent nodes for each layer of the tree.
137
+
-`reduceSingleLeafToSelf` (boolean, defaults to `false`): optimization for, when reducing a set of nodes with one node, reduce it to that node.
138
+
-`dirBuilder` (object): the options for the directory builder
139
+
-`hamt` (object): the options for the HAMT sharded directory builder
140
+
- bits (positive integer, defaults to `5`): the number of bits at each bucket of the HAMT
139
141
140
-
### Example Exporter
142
+
### Exporter
141
143
142
-
```
143
-
// Create an export readable object stream with the hash you want to export and a dag service
144
-
const filesStream = Exporter(<multihash>, <dag or ipld-resolver instance>)
144
+
#### Exporter example
145
+
146
+
```js
147
+
// Create an export source pull-stream cid or ipfs path you want to export and a
148
+
// <dag or ipld-resolver instance> to fetch the file from
149
+
constfilesStream=Exporter(<cid or ipfsPath>, <dag or ipld-resolver instance>)
0 commit comments