-
Notifications
You must be signed in to change notification settings - Fork 30
maybe use stream.Readable.toWeb
#126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I was just looking at this part of your code, and was considering this question. I came to the conclusion there would be no benefit. You create a Node stream with A more aggressive change might be to change |
yup, it will just be unnecessary overhead. the best solution would be to get rid of the toIterator entirely so that it never touches the main thread so that we could do something like this instead: function concatenateReadables(readables) {
const ts = new TransformStream();
let promise = Promise.resolve();
for (const readable of readables) {
promise = promise.then(
() => readable.pipeTo(ts.writable, { preventClose: true }),
reason => {
return Promise.all([
ts.writable.abort(reason),
readable.cancel(reason)
]);
}
);
}
promise.then(() => ts.writable.close(),
reason => ts.writable.abort(reason))
.catch(() => {});
return ts.readable;
} ref: https://streams.spec.whatwg.org/#example-identity-transform-usages |
stream.Readable.toWeb(streamReadable) got introduced in 17.0.0
while it's not necessary to use it... i would like to know if it brings any benefit from using it over
fs.createWriteStream(path)
and instead do
stream.Readable.toWeb(fs.createWriteStream(path))
The text was updated successfully, but these errors were encountered: