Remove event listeners on stream end

This commit is contained in:
Fedor Indutny 2024-08-05 13:33:04 -07:00 committed by GitHub
parent 02b01d4323
commit 0350f98f98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,6 +10,8 @@ export function toWebStream(readable: Readable): ReadableStream<Buffer> {
let controller: ReadableStreamDefaultController<Buffer>;
const cleanup = finished(readable, err => {
cleanup();
if (err != null) {
return controller.error(err);
}