
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
node-fetch-cjs
Advanced tools
A wrapper for node-fetch (a light-weight module that brings Fetch API to node.js) to be used in commonjs environment.
This package is a wrapper for Node Fetch v3 for commonjs environments.
Since v3, node-fetch only provides an ESM version of the package.
While this choice is a good choice for the future, it is impacting a lot of codebases built on commonjs environment. Some of them could update their code to import node-fetch using native import() but many could not. This is especially true for TypeScript users who cannot mix commonjs and ESM imports in their projects.
This module bundles node-fetch using esbuild and apply some custom transformations to make sure it works in commonjs environments.
If you are able to migrate to the official v3 release of node-fetch, we highly recommend to use the official node-fetch. This package is built to help users who could not migrate easily.
This repository is automatically updated when a new version of node-fetch is released
$ npm install node-fetch-cjs
Destructuring export (recommended):
const { default: fetch, Headers } = require("node-fetch-cjs");
fetch(/* ... */).then(/* ... */);
const headers = new Headers();
Legacy export:
const fetch = require("node-fetch-cjs");
fetch.default(/* ... */).then(/* ... */);
const headers = new fetch.Headers();
Full documentation is available on the node-fetch repository.
In order to be fully CJS compatible, we had to bundle dependencies from node-fetch directly into this package.
This means that both fetch-blob and formdata-polyfill are bundled.
For your convenience, these dependencies are exported to allow you to use them in your code:
const { Blob, FormData } = require("node-fetch-cjs");
const blob = new Blob(["content"], { type: "text/plain" });
const text = await blob.text();
const data = new FormData();
data.append("key", "value");
Types are bundled with node-fetch-cjs, so you don't need to install any additional packages.
Thanks to node-fetch/node-fetch for their work to allow all of us to use fetch in Node.JS environments.
FAQs
A wrapper for node-fetch (a light-weight module that brings Fetch API to node.js) to be used in commonjs environment.
The npm package node-fetch-cjs receives a total of 2,396 weekly downloads. As such, node-fetch-cjs popularity was classified as popular.
We found that node-fetch-cjs 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
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.