@whatwg-node/node-fetch 0.7.0 → 0.7.1-rc-20241109110503-3ed03e7ecf975aca6e5ec7cebb5581602a23fa7d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/ReadableStream.js +10 -1
- package/esm/ReadableStream.js +10 -1
- package/package.json +1 -1
package/cjs/ReadableStream.js
CHANGED
@@ -181,7 +181,13 @@ class PonyfillReadableStream {
|
|
181
181
|
}
|
182
182
|
}
|
183
183
|
pipeThrough({ writable, readable, }) {
|
184
|
-
this.pipeTo(writable)
|
184
|
+
this.pipeTo(writable).catch(err => {
|
185
|
+
this.readable.destroy(err);
|
186
|
+
});
|
187
|
+
if (isPonyfillReadableStream(readable)) {
|
188
|
+
readable.readable.once('error', err => this.readable.destroy(err));
|
189
|
+
readable.readable.once('finish', () => this.readable.push(null));
|
190
|
+
}
|
185
191
|
return readable;
|
186
192
|
}
|
187
193
|
static [Symbol.hasInstance](instance) {
|
@@ -189,6 +195,9 @@ class PonyfillReadableStream {
|
|
189
195
|
}
|
190
196
|
}
|
191
197
|
exports.PonyfillReadableStream = PonyfillReadableStream;
|
198
|
+
function isPonyfillReadableStream(obj) {
|
199
|
+
return obj?.readable != null;
|
200
|
+
}
|
192
201
|
function isPonyfillWritableStream(obj) {
|
193
202
|
return obj?.writable != null;
|
194
203
|
}
|
package/esm/ReadableStream.js
CHANGED
@@ -178,13 +178,22 @@ export class PonyfillReadableStream {
|
|
178
178
|
}
|
179
179
|
}
|
180
180
|
pipeThrough({ writable, readable, }) {
|
181
|
-
this.pipeTo(writable)
|
181
|
+
this.pipeTo(writable).catch(err => {
|
182
|
+
this.readable.destroy(err);
|
183
|
+
});
|
184
|
+
if (isPonyfillReadableStream(readable)) {
|
185
|
+
readable.readable.once('error', err => this.readable.destroy(err));
|
186
|
+
readable.readable.once('finish', () => this.readable.push(null));
|
187
|
+
}
|
182
188
|
return readable;
|
183
189
|
}
|
184
190
|
static [Symbol.hasInstance](instance) {
|
185
191
|
return isReadableStream(instance);
|
186
192
|
}
|
187
193
|
}
|
194
|
+
function isPonyfillReadableStream(obj) {
|
195
|
+
return obj?.readable != null;
|
196
|
+
}
|
188
197
|
function isPonyfillWritableStream(obj) {
|
189
198
|
return obj?.writable != null;
|
190
199
|
}
|
package/package.json
CHANGED