@whatwg-node/node-fetch 0.0.3-alpha-20230205160723-6e9b185 → 0.0.3
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/Blob.d.ts +3 -1
- package/index.js +6 -1
- package/index.mjs +6 -1
- package/package.json +1 -1
package/Blob.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { Blob as NodeBlob } from 'buffer';
|
3
|
-
|
3
|
+
declare const PonyfillBlob_base: typeof NodeBlob;
|
4
|
+
export declare class PonyfillBlob extends PonyfillBlob_base implements Blob {
|
4
5
|
stream(): any;
|
5
6
|
slice(...args: any[]): any;
|
6
7
|
}
|
@@ -8,3 +9,4 @@ export interface PonyfillBlob {
|
|
8
9
|
prototype: Blob;
|
9
10
|
new (blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
|
10
11
|
}
|
12
|
+
export {};
|
package/index.js
CHANGED
@@ -172,9 +172,14 @@ class PonyfillReadableStream {
|
|
172
172
|
}
|
173
173
|
}
|
174
174
|
|
175
|
+
class DummyBlob {
|
176
|
+
constructor() {
|
177
|
+
throw new Error('Blob is not supported in this environment, if you are using an older version of Node v14, please upgrade to v14.17.0 or higher');
|
178
|
+
}
|
179
|
+
}
|
175
180
|
// Will be removed after v14 reaches EOL
|
176
181
|
// Needed because v14 doesn't have .stream() implemented
|
177
|
-
class PonyfillBlob extends buffer.Blob {
|
182
|
+
class PonyfillBlob extends (buffer.Blob || DummyBlob) {
|
178
183
|
stream() {
|
179
184
|
return new PonyfillReadableStream({
|
180
185
|
start: async (controller) => {
|
package/index.mjs
CHANGED
@@ -166,9 +166,14 @@ class PonyfillReadableStream {
|
|
166
166
|
}
|
167
167
|
}
|
168
168
|
|
169
|
+
class DummyBlob {
|
170
|
+
constructor() {
|
171
|
+
throw new Error('Blob is not supported in this environment, if you are using an older version of Node v14, please upgrade to v14.17.0 or higher');
|
172
|
+
}
|
173
|
+
}
|
169
174
|
// Will be removed after v14 reaches EOL
|
170
175
|
// Needed because v14 doesn't have .stream() implemented
|
171
|
-
class PonyfillBlob extends Blob {
|
176
|
+
class PonyfillBlob extends (Blob || DummyBlob) {
|
172
177
|
stream() {
|
173
178
|
return new PonyfillReadableStream({
|
174
179
|
start: async (controller) => {
|