镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
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
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);
}));
}