{"id":15251790,"url":"https://github.com/touchifyapp/node-fetch-cjs","last_synced_at":"2025-04-10T22:37:34.437Z","repository":{"id":62354824,"uuid":"414703417","full_name":"touchifyapp/node-fetch-cjs","owner":"touchifyapp","description":"A wrapper for node-fetch (a light-weight module that brings Fetch API to node.js) to be used in commonjs environment.","archived":false,"fork":false,"pushed_at":"2023-09-12T10:20:44.000Z","size":73,"stargazers_count":15,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-20T16:43:50.194Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/touchifyapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-07T17:49:30.000Z","updated_at":"2024-01-20T15:57:01.000Z","dependencies_parsed_at":"2024-06-18T20:04:49.738Z","dependency_job_id":"d0424b3c-40a4-428c-a24b-2af257e08bd4","html_url":"https://github.com/touchifyapp/node-fetch-cjs","commit_stats":{"total_commits":39,"total_committers":2,"mean_commits":19.5,"dds":"0.20512820512820518","last_synced_commit":"e8c70313effd6450dcdf19f3bc57e11f2b5feccd"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/touchifyapp%2Fnode-fetch-cjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/touchifyapp%2Fnode-fetch-cjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/touchifyapp%2Fnode-fetch-cjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/touchifyapp%2Fnode-fetch-cjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/touchifyapp","download_url":"https://codeload.github.com/touchifyapp/node-fetch-cjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248311719,"owners_count":21082632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-29T18:06:31.199Z","updated_at":"2025-04-10T22:37:34.405Z","avatar_url":"https://github.com/touchifyapp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node Fetch CJS\n\nThis package is a wrapper for [Node Fetch v3](https://github.com/node-fetch/node-fetch) for commonjs environments.\n\n## Motivation\n\nSince v3, `node-fetch` only provides an `ESM` version of the package.\n\nWhile 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.\n\nThis module bundles `node-fetch` using [esbuild](https://esbuild.github.io) and apply some custom transformations to make sure it works in `commonjs` environments.\n\n**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.**\n\n*This repository is automatically updated when a new version of node-fetch is released*\n\n## Installation\n\n```bash\n$ npm install node-fetch-cjs\n```\n\n## Usage\n\nDestructuring export (recommended):\n```javascript\nconst { default: fetch, Headers } = require(\"node-fetch-cjs\");\n\nfetch(/* ... */).then(/* ... */);\n\nconst headers = new Headers();\n```\n\nLegacy export:\n```javascript\nconst fetch = require(\"node-fetch-cjs\");\n\nfetch.default(/* ... */).then(/* ... */);\n\nconst headers = new fetch.Headers();\n```\n\n## Full documentation\n\nFull documentation is available on the [node-fetch](https://github.com/node-fetch/node-fetch) repository.\n\n## Differences\n\nIn order to be fully CJS compatible, we had to bundle dependencies from `node-fetch` directly into this package.\nThis means that both `fetch-blob` and `formdata-polyfill` are bundled.\n\nFor your convenience, these dependencies are exported to allow you to use them in your code:\n\n```javascript\nconst { Blob, FormData } = require(\"node-fetch-cjs\");\n\nconst blob = new Blob([\"content\"], { type: \"text/plain\" });\nconst text = await blob.text();\n\nconst data = new FormData();\ndata.append(\"key\", \"value\");\n```\n\n## TypeScript\n\nTypes are bundled with `node-fetch-cjs`, so you don't need to install any additional packages.\n\n## Acknowledgement\n\nThanks to [node-fetch/node-fetch](https://github.com/node-fetch/node-fetch) for their work to allow all of us to use `fetch` in Node.JS environments.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftouchifyapp%2Fnode-fetch-cjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftouchifyapp%2Fnode-fetch-cjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftouchifyapp%2Fnode-fetch-cjs/lists"}