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

Adds call to progress bar function #179

Merged
merged 6 commits into from
Sep 5, 2017

Conversation

bmordan
Copy link
Contributor

@bmordan bmordan commented Sep 1, 2017

This change adds a call to an optional function that can be passed to Importer.
This will be called with the byte length of a file's buffered chunk.

The idea is you can pass a function into the Importer and have that function called as a step in the pull stream that creates and stores a file/files.

This change adds a call to an optional function that can be passed to `Importer`. This will be called with the byteLength of a file's buffered chunk.
@@ -93,7 +93,10 @@ module.exports = function (createChunker, ipldResolver, createReducer, _options)
pull(
file.content,
createChunker(options.chunkerOptions),
pull.map(chunk => new Buffer(chunk)),
pull.map(chunk => {
if (options.progress) options.progress(chunk.byteLength)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should check that it is also a function

This commit also updates the readme.md file with a discription for how to use this option.
Copy link
Contributor

@daviddias daviddias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be tested in order to merge

in some of my tests I was writing

```
expect(someTrueValue).to.be.true
```

but this is an `unused-expressions` in the eyes of eslint. So the work around is to just `expect(someTrueValue).to.equal(true)`.
@daviddias daviddias merged commit ac6f722 into ipfs-inactive:master Sep 5, 2017
@alanshaw alanshaw deleted the progress-bar branch September 5, 2017 13:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants