@whatwg-node/node-fetch 0.4.6 → 0.4.7-rc-20230710183802-40c2cb4
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/Body.js +16 -8
- package/esm/Body.js +16 -8
- package/package.json +1 -1
package/cjs/Body.js
CHANGED
@@ -89,15 +89,23 @@ class PonyfillBody {
|
|
89
89
|
const blob = await this.blob();
|
90
90
|
return blob.arrayBuffer();
|
91
91
|
}
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
92
|
+
_collectChunksFromReadable() {
|
93
|
+
return new Promise((resolve, reject) => {
|
94
|
+
const chunks = [];
|
95
|
+
const _body = this.generateBody();
|
96
|
+
if (_body) {
|
97
|
+
_body.readable.on('data', chunk => {
|
98
|
+
chunks.push(chunk);
|
99
|
+
});
|
100
|
+
_body.readable.on('end', () => {
|
101
|
+
resolve(chunks);
|
102
|
+
});
|
103
|
+
_body.readable.on('error', e => {
|
104
|
+
reject(e);
|
105
|
+
});
|
98
106
|
}
|
99
|
-
|
100
|
-
|
107
|
+
return chunks;
|
108
|
+
});
|
101
109
|
}
|
102
110
|
async blob() {
|
103
111
|
if (this.bodyType === BodyInitType.Blob) {
|
package/esm/Body.js
CHANGED
@@ -85,15 +85,23 @@ export class PonyfillBody {
|
|
85
85
|
const blob = await this.blob();
|
86
86
|
return blob.arrayBuffer();
|
87
87
|
}
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
88
|
+
_collectChunksFromReadable() {
|
89
|
+
return new Promise((resolve, reject) => {
|
90
|
+
const chunks = [];
|
91
|
+
const _body = this.generateBody();
|
92
|
+
if (_body) {
|
93
|
+
_body.readable.on('data', chunk => {
|
94
|
+
chunks.push(chunk);
|
95
|
+
});
|
96
|
+
_body.readable.on('end', () => {
|
97
|
+
resolve(chunks);
|
98
|
+
});
|
99
|
+
_body.readable.on('error', e => {
|
100
|
+
reject(e);
|
101
|
+
});
|
94
102
|
}
|
95
|
-
|
96
|
-
|
103
|
+
return chunks;
|
104
|
+
});
|
97
105
|
}
|
98
106
|
async blob() {
|
99
107
|
if (this.bodyType === BodyInitType.Blob) {
|