Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
native-fetch
Advanced tools
Returns native fetch/Request/Headers if available or the node-fetch module if not
A drop-in replacement for the node-fetch
module that returns the native fetch if available or the polyfill if not.
Some environments such as the Electron Renderer process straddle the node/browser divide with features from both APIs available. In these cases the webpack approach of always using the browser
field in your package.json
to override requires is too heavy-handed as sometimes you want to use the node version of an API.
Instead we can check for the availability of a given API and return it, rather than the node-polyfill for that API.
You must install a version of node-fetch
alongside this module to be used if a native implementation is not available.
$ npm install --save native-fetch node-fetch
const fetch = require('native-fetch')
fetch('https://github.com/')
.then(res => res.text())
.then(body => console.log(body))
2.0.1 (2020-10-06)
<a name="0.0.1"></a>
FAQs
Returns native fetch if available or the undici module if not
The npm package native-fetch receives a total of 92,220 weekly downloads. As such, native-fetch popularity was classified as popular.
We found that native-fetch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.