Skip to content
This repository was archived by the owner on Apr 29, 2020. It is now read-only.

Commit a84a745

Browse files
committed
Revert "chore: remove the conditional"
This reverts commit 0109807. Fixes ipfs/js-ipfs#1810.
1 parent 3199688 commit a84a745

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/builder/builder.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ const defaultOptions = {
2424
rawLeaves: false,
2525
hashAlg: 'sha2-256',
2626
leafType: 'file',
27-
cidVersion: 0,
28-
progress: () => {}
27+
cidVersion: 0
2928
}
3029

3130
module.exports = function builder (createChunker, ipld, createReducer, _options) {
@@ -107,8 +106,10 @@ module.exports = function builder (createChunker, ipld, createReducer, _options)
107106
pull(
108107
file.content,
109108
chunker,
110-
through(buffer => {
111-
options.progress(buffer.length)
109+
through(chunk => {
110+
if (options.progress && typeof options.progress === 'function') {
111+
options.progress(chunk.byteLength)
112+
}
112113
}),
113114
paraMap((buffer, callback) => {
114115
waterfall([

0 commit comments

Comments
 (0)