Skip to content

Commit abbfe0c

Browse files
jasnyachingbrain
andauthored
docs: example in README of ipfs-unixfs-importer (#303)
* import `node:fs` * remove undefined variables: `file`, `file2`, and `options` * fix typo causing error "no such file or directory, open './foo/quux'" --------- Co-authored-by: Alex Potsides <[email protected]>
1 parent 46f4de5 commit abbfe0c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/ipfs-unixfs-importer/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,21 @@ And write the importing logic:
5252
```js
5353
import { importer } from 'ipfs-unixfs-importer'
5454
import { MemoryBlockstore } from 'blockstore-core/memory'
55+
import * as fs from 'node:fs'
5556

5657
// Where the blocks will be stored
5758
const blockstore = new MemoryBlockstore()
5859

59-
// Import path /tmp/foo/bar
60+
// Import path /tmp/foo/
6061
const source = [{
6162
path: '/tmp/foo/bar',
62-
content: fs.createReadStream(file)
63+
content: fs.createReadStream('/tmp/foo/bar')
6364
}, {
6465
path: '/tmp/foo/quxx',
65-
content: fs.createReadStream(file2)
66+
content: fs.createReadStream('/tmp/foo/quux')
6667
}]
6768

68-
for await (const entry of importer(source, blockstore, options)) {
69+
for await (const entry of importer(source, blockstore)) {
6970
console.info(entry)
7071
}
7172
```

0 commit comments

Comments
 (0)