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
The `importer` function returns an async iterator takes a source async iterator that yields objects of the form:
100
102
@@ -109,9 +111,9 @@ The `importer` function returns an async iterator takes a source async iterator
109
111
110
112
`stream` will output file info objects as files get stored in IPFS. When stats on a node are emitted they are guaranteed to have been written.
111
113
112
-
`ipld` is an instance of the [`IPLD Resolver`](https://github.com/ipld/js-ipld-resolver)
114
+
`blockstore` is an instance of a [blockstore][]
113
115
114
-
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.
116
+
The input's file paths and directory structure will be preserved in the [`dag-pb`](https://github.com/ipld/js-dag-pb) created nodes.
115
117
116
118
`options` is an JavaScript option that might include the following keys:
117
119
@@ -150,20 +152,20 @@ Several aspects of the importer are overridable by specifying functions as part
150
152
- It should yield `Buffer` objects constructed from the `source` or throw an `Error`
151
153
-`chunker` (function): Optional function that supports the signature `async function * (source, options)` where `source` is an async generator and `options` is an options object
152
154
- It should yield `Buffer` objects.
153
-
-`bufferImporter` (function): Optional function that supports the signature `async function * (entry, ipld, options)`
154
-
- This function should read `Buffer`s from `source` and persist them using `ipld.put` or similar
155
+
-`bufferImporter` (function): Optional function that supports the signature `async function * (entry, blockstore, options)`
156
+
- This function should read `Buffer`s from `source` and persist them using `blockstore.put` or similar
155
157
-`entry` is the `{ path, content }` entry, where `entry.content` is an async generator that yields Buffers
156
158
- It should yield functions that return a Promise that resolves to an object with the properties `{ cid, unixfs, size }` where `cid` is a [CID], `unixfs` is a [UnixFS] entry and `size` is a `Number` that represents the serialized size of the [IPLD] node that holds the buffer data.
157
159
- Values will be pulled from this generator in parallel - the amount of parallelisation is controlled by the `blockWriteConcurrency` option (default: 10)
158
-
-`dagBuilder` (function): Optional function that supports the signature `async function * (source, ipld, options)`
160
+
-`dagBuilder` (function): Optional function that supports the signature `async function * (source, blockstore, options)`
159
161
- This function should read `{ path, content }` entries from `source` and turn them into DAGs
160
162
- It should yield a `function` that returns a `Promise` that resolves to `{ cid, path, unixfs, node }` where `cid` is a `CID`, `path` is a string, `unixfs` is a UnixFS entry and `node` is a `DAGNode`.
161
163
- Values will be pulled from this generator in parallel - the amount of parallelisation is controlled by the `fileImportConcurrency` option (default: 50)
162
-
-`treeBuilder` (function): Optional function that supports the signature `async function * (source, ipld, options)`
164
+
-`treeBuilder` (function): Optional function that supports the signature `async function * (source, blockstore, options)`
163
165
- This function should read `{ cid, path, unixfs, node }` entries from `source` and place them in a directory structure
164
166
- It should yield an object with the properties `{ cid, path, unixfs, size }` where `cid` is a `CID`, `path` is a string, `unixfs` is a UnixFS entry and `size` is a `Number`.
Copy file name to clipboardExpand all lines: packages/ipfs-unixfs/README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -47,15 +47,15 @@ The UnixFS spec can be found inside the [ipfs/specs repository](http://github.co
47
47
### Use in Node.js
48
48
49
49
```JavaScript
50
-
var { UnixFS } =require('ipfs-unixfs')
50
+
import { UnixFS } from'ipfs-unixfs'
51
51
```
52
52
53
53
### Use in a browser with browserify, webpack or any other bundler
54
54
55
55
The code published to npm that gets loaded on require is in fact a ES5 transpiled version with the right shims added. This means that you can require it and use with your favourite bundler without having to adjust asset management process.
0 commit comments