Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Commit

Permalink
fix #188
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias authored Sep 19, 2017
1 parent 2f37c79 commit d78f82c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ And write the importing logic:

```js
const Importer = require('ipfs-unixfs-engine').Importer
const filesAddStream = new Importer(<dag or ipld-resolver instance)

// You need to create and pass an ipld-resolve instance
// https://github.com/ipld/js-ipld-resolver
const filesAddStream = new Importer(<ipld-resolver instance>)

// An array to hold the return of nested file/dir info from the importer
// A root DAG Node is received upon completion
Expand All @@ -62,8 +65,8 @@ const res = []
// Import path /tmp/foo/bar
const rs = fs.createReadStream(file)
const rs2 = fs.createReadStream(file2)
const input = { path: /tmp/foo/bar, content: rs }
const input2 = { path: /tmp/foo/quxx, content: rs2 }
const input = { path: '/tmp/foo/bar', content: rs }
const input2 = { path: '/tmp/foo/quxx', content: rs2 }

// Listen for the data event from the importer stream
filesAddStream.on('data', (info) => res.push(info))
Expand Down

0 comments on commit d78f82c

Please sign in to comment.