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

Commit f8ffa2b

Browse files
author
Alan Shaw
committed
fix: getPullStream in Firefox
I'm not entirely sure why this wasn't working, but I changed the code to not buffer the output and the test started passing. Hooray \o/ License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
1 parent 85b7658 commit f8ffa2b

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/files-regular/get-pull-stream.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const cleanCID = require('../utils/clean-cid')
44
const TarStreamToObjects = require('../utils/tar-stream-to-objects')
55
const v = require('is-ipfs')
6-
const through = require('through2')
76
const pull = require('pull-stream')
87
const toPull = require('stream-to-pull-stream')
98
const deferred = require('pull-defer')
@@ -28,15 +27,15 @@ module.exports = (send) => {
2827
send.andTransform(request, TarStreamToObjects, (err, stream) => {
2928
if (err) { return p.end(err) }
3029

31-
const files = []
32-
stream.pipe(through.obj((file, enc, next) => {
33-
if (file.content) {
34-
files.push({ path: file.path, content: toPull(file.content) })
35-
} else {
36-
files.push(file)
37-
}
38-
next()
39-
}, () => p.resolve(pull.values(files))))
30+
p.resolve(
31+
pull(
32+
toPull.source(stream),
33+
pull.map(file => {
34+
const { path, content } = file
35+
return content ? { path, content: toPull.source(content) } : file
36+
})
37+
)
38+
)
4039
})
4140

4241
return p

0 commit comments

Comments
 (0)