node-fetch patch by jimmywarting #181
@@ -1,7 +1,7 @@
|
|||||||
const fetch = (...args) => import('node-fetch').then(mod => mod.default(...args));
|
const fetchS = (...args) => import("node-fetch").then(mod => mod.default(...args));
|
||||||
if (typeof fetch === "undefined") global.fetch = fetch;
|
if (typeof fetch === "undefined") global.fetch = fetchS;
|
||||||
module.exports = {
|
module.exports = {
|
||||||
JSON: async (url = "", options) => await (await fetch(url, options)).json(),
|
JSON: async (url = "", options) => await (await fetchS(url, options)).json(),
|
||||||
TEXT: async (url = "", options) => await (await fetch(url, options)).text(),
|
TEXT: async (url = "", options) => await (await fetchS(url, options)).text(),
|
||||||
BUFFER: async (url = "", options) => Buffer.from(await (await fetch(url, options)).arrayBuffer()),
|
BUFFER: async (url = "", options) => Buffer.from(await (await fetchS(url, options)).arrayBuffer()),
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user