Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
stream: fix pipeline with dest in objectMode
pipeline did not support destination with generator
that does not return strings or buffers.
  • Loading branch information
ronag committed Mar 25, 2020
commit ee3aa343ad675d8ce39eb5a210f745d0331b11a2
4 changes: 3 additions & 1 deletion lib/internal/streams/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ function pipeline(...streams) {
// always returns a stream which can be further
// composed through `.pipe(stream)`.

const pt = new PassThrough();
const pt = new PassThrough({
objectMode: true
Comment thread
lpinca marked this conversation as resolved.
Outdated
});
if (isPromise(ret)) {
ret
.then((val) => {
Expand Down
12 changes: 12 additions & 0 deletions test/parallel/test-stream-pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -1065,3 +1065,15 @@ const { promisify } = require('util');
src.push('asd');
dst.destroy();
}

{
pipeline(async function * () {
yield 'asd';
}, async function * (source) {
for await (const chunk of source) {
yield { chunk };
}
}, common.mustCall((err) => {
assert.ifError(err);
}));
}