@whatwg-node/node-fetch 0.7.23-alpha-20250725190806-5df0ede70a22656416fd7a0f626f8d5ba8238197 → 0.7.23-alpha-20250725192842-30aa375091fdb305ec731d51c061cc2c21f3b773
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/utils.js +2 -16
- package/esm/utils.js +2 -16
- package/package.json +1 -1
package/cjs/utils.js
CHANGED
@@ -11,6 +11,7 @@ exports.pipeThrough = pipeThrough;
|
|
11
11
|
exports.endStream = endStream;
|
12
12
|
exports.safeWrite = safeWrite;
|
13
13
|
const node_events_1 = require("node:events");
|
14
|
+
const node_stream_1 = require("node:stream");
|
14
15
|
function isHeadersInstance(obj) {
|
15
16
|
return obj?.forEach != null;
|
16
17
|
}
|
@@ -64,22 +65,7 @@ function pipeThrough({ src, dest, signal, onError, }) {
|
|
64
65
|
dest.destroy(e);
|
65
66
|
});
|
66
67
|
if (signal) {
|
67
|
-
|
68
|
-
try {
|
69
|
-
signal.throwIfAborted();
|
70
|
-
}
|
71
|
-
catch (abortError) {
|
72
|
-
// destroying the src stream will destroy the dest stream as well
|
73
|
-
src.destroy(abortError);
|
74
|
-
}
|
75
|
-
}
|
76
|
-
if (signal.aborted) {
|
77
|
-
// if the signal is already aborted, we can just destroy the
|
78
|
-
// src stream and not start pipe at all
|
79
|
-
handleAbort();
|
80
|
-
return;
|
81
|
-
}
|
82
|
-
signal.addEventListener('abort', handleAbort, { once: true });
|
68
|
+
(0, node_stream_1.addAbortSignal)(signal, src);
|
83
69
|
}
|
84
70
|
src.pipe(dest, { end: true /* already default */ });
|
85
71
|
}
|
package/esm/utils.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { once } from 'node:events';
|
2
|
+
import { addAbortSignal } from 'node:stream';
|
2
3
|
function isHeadersInstance(obj) {
|
3
4
|
return obj?.forEach != null;
|
4
5
|
}
|
@@ -51,22 +52,7 @@ export function pipeThrough({ src, dest, signal, onError, }) {
|
|
51
52
|
dest.destroy(e);
|
52
53
|
});
|
53
54
|
if (signal) {
|
54
|
-
|
55
|
-
try {
|
56
|
-
signal.throwIfAborted();
|
57
|
-
}
|
58
|
-
catch (abortError) {
|
59
|
-
// destroying the src stream will destroy the dest stream as well
|
60
|
-
src.destroy(abortError);
|
61
|
-
}
|
62
|
-
}
|
63
|
-
if (signal.aborted) {
|
64
|
-
// if the signal is already aborted, we can just destroy the
|
65
|
-
// src stream and not start pipe at all
|
66
|
-
handleAbort();
|
67
|
-
return;
|
68
|
-
}
|
69
|
-
signal.addEventListener('abort', handleAbort, { once: true });
|
55
|
+
addAbortSignal(signal, src);
|
70
56
|
}
|
71
57
|
src.pipe(dest, { end: true /* already default */ });
|
72
58
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@whatwg-node/node-fetch",
|
3
|
-
"version": "0.7.23-alpha-
|
3
|
+
"version": "0.7.23-alpha-20250725192842-30aa375091fdb305ec731d51c061cc2c21f3b773",
|
4
4
|
"description": "Fetch API implementation for Node",
|
5
5
|
"sideEffects": false,
|
6
6
|
"dependencies": {
|