stream: fix pipeline with dest in objectMode
pipeline did not support destination with generator that does not return strings or buffers. PR-URL: https://github.com/nodejs/node/pull/32414 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
9e3eddc75d
commit
05f1df5200
@ -240,7 +240,9 @@ function pipeline(...streams) {
|
|||||||
// always returns a stream which can be further
|
// always returns a stream which can be further
|
||||||
// composed through `.pipe(stream)`.
|
// composed through `.pipe(stream)`.
|
||||||
|
|
||||||
const pt = new PassThrough();
|
const pt = new PassThrough({
|
||||||
|
objectMode: true
|
||||||
|
});
|
||||||
if (isPromise(ret)) {
|
if (isPromise(ret)) {
|
||||||
ret
|
ret
|
||||||
.then((val) => {
|
.then((val) => {
|
||||||
|
@ -1065,3 +1065,15 @@ const { promisify } = require('util');
|
|||||||
src.push('asd');
|
src.push('asd');
|
||||||
dst.destroy();
|
dst.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
pipeline(async function * () {
|
||||||
|
yield 'asd';
|
||||||
|
}, async function * (source) {
|
||||||
|
for await (const chunk of source) {
|
||||||
|
yield { chunk };
|
||||||
|
}
|
||||||
|
}, common.mustCall((err) => {
|
||||||
|
assert.ifError(err);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user