ipfs-utils
Version:
Package to aggregate shared logic and dependencies for the IPFS ecosystem
23 lines (17 loc) • 549 B
JavaScript
/**
* @typedef {object} fetchImpl
* @property {globalThis.fetch} fetchImpl.fetch
* @property {globalThis.Request} fetchImpl.Request
* @property {globalThis.Response} fetchImpl.Response
* @property {globalThis.Headers} fetchImpl.Headers
*/
let implName = './fetch.node'
if (typeof XMLHttpRequest === 'function') {
// Electron has `XMLHttpRequest` and should get the browser implementation
// instead of node.
implName = './fetch.browser'
}
/** @type {fetchImpl} */
const fetch = require(implName)
module.exports = fetch