{"_id":"@whatwg-node/fetch@0.12.1","bob":false,"bugs":{"url":"https://github.com/ardatan/whatwg-node/issues"},"dist":{"shasum":"81eaba6caaf3615987be27133d1b52d5308ec7a6","tarball":"http://registry-npm.ywwl.com/@whatwg-node/fetch/download/@whatwg-node/fetch-0.12.1.tgz","fileCount":9,"integrity":"sha512-MjSXerFVxhWwPXZMNp4b4Q3WZMEIqzinHVWuH5tF2LNGy4hHypqPJCNpaR6bEZbaGdlH+r5dRAmQ8bxowcetjQ==","signatures":[{"sig":"MEQCIHeloCGsXBPX90nuC3Sx6OALowq1+CY8IL+RYsjDutktAiAoXQtkOfIFkZlmUSCksoHSfTuPqkHicyz7LdNntqO+nQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDnkfjAyqVgyDlJ+hVkRZk16LHuDGYoud2DYt4eSIz7DAIgfBJ9sOAB4TbXSbFYNqR5jGW94at9Befwhjc+GmFq2UE="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@whatwg-node%2ffetch@0.12.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":59125,"size":14709,"noattachment":false,"key":"/@whatwg-node/fetch/-/@whatwg-node/fetch-0.12.1.tgz"},"main":"dist/node-ponyfill.js","name":"@whatwg-node/fetch","types":"dist/index.d.ts","author":{"name":"Arda TANRIKULU","email":"ardatanrikulu@gmail.com"},"browser":"dist/global-ponyfill.js","denoify":{"index":"dist/esm-ponyfill.js"},"engines":{"node":">=22.15.0"},"gitHead":"050a5fdddfcca13415b2087b5258f8c9f0e7482b","license":"MIT","version":"0.12.1","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"047fec0f-3bbb-4cd2-b503-a74c3c0e4b62"}},"homepage":"https://github.com/ardatan/whatwg-node#readme","repository":{"url":"git+https://github.com/ardatan/whatwg-node.git","type":"git","directory":"packages/fetch"},"_npmVersion":"11.19.1","description":"Cross Platform Smart Fetch Ponyfill","directories":{},"maintainers":[{"name":"ardatan","email":"ardatanrikulu@gmail.com"},{"name":"theguild-bot","email":"bot@the-guild.dev"}],"sideEffects":false,"_nodeVersion":"26.10.0","dependencies":{"urlpattern-polyfill":"^10.0.0","@whatwg-node/node-fetch":"^0.9.1"},"react-native":"dist/global-ponyfill.js","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fetch_0.12.1_1790804980281_0.7216940765111024"},"readme":"# `@whatwg-node/fetch`\n\nA ponyfill package for the [Fetch Standard](https://fetch.spec.whatwg.org/). If your JavaScript\nenvironment doesn't implement this standard natively, this package automatically ponyfills the\nmissing parts, and export them as a module; otherwise it exports the native ones without touching\nthe environment's internals. It also exports some additional standard APIs that are required by the\nFetch Standard.\n\n## Installation\n\n```bash\nnpm install @whatwg-node/fetch\n```\n\n## Why Fetch API and why this ponyfill in general?\n\nIf you are building a JavaScript library, and you want it to support all JavaScript environments not\nonly Node.js. Fetch API is the best choice for you. Because it's a standard, and it's implemented by\nthe most environments out there expect Node.js :). So you can use Fetch API in your library, and\nyour users can use it in their browsers, Deno, Bun, Cloudflare Works, and in Node.js.\n\n> This is how we support all JavaScript environments in\n> [GraphQL Yoga](https://the-guild.dev/graphql/yoga-server/docs/integrations/z-other-environments).\n> In GraphQL Yoga, we don't care which JavaScript environment you prefer, we support all of them.\n\n## Why we should still use these for Node.js even if it already implements them natively\n\n### Differences from Node.js `fetch`\n\nEven if newer Node.js already implements Fetch API and Data Text Encoding API natively, we still\nrecommend to use this package, because this package implements them for Node.js in more efficient\nway.\n\n- [See problems with the global fetch/undici in Node.js](https://github.com/nodejs/undici/issues/1203)\n- - We offer a patched version of `node-fetch` that doesn't use `undici` and Node.js streams\n    internally, so it's more efficient than the native one.\n- [See problems with text encoding API in Node.js](https://github.com/nodejs/node/issues/39879)\n- - We use [`Buffer`](https://nodejs.org/api/buffer.html) instead of the native one, because\n    `Buffer` is faster than the native one unfortunately.\n- `Body.formData()` is not implemented by Node.js, so we implement it with `busboy` internally. So\n  you can consume incoming multipart(file uploads) requests with `.formData` in Node.js.\n- `file:` protocol support... As in Bun, Deno and other similar Fetch implementations, undici's\n  fetch doesn't support `file:` protocol. `@whatwg-node/fetch` allows you to support it in platform\n  agnostic way.\n\n### Handling file uploads with Fetch API\n\n```ts\nimport { Request } from '@whatwg-node/fetch'\n\n// See how you can handle file uploads with Fetch API\nhttp.createServer(async (req, res) => {\n  const request = new Request(req)\n  const formData = await request.formData()\n  const file = formData.get('file')\n  // ...\n})\n```\n\n> If you want to limit the size of the multipart form data, you can use `createFetch`. See the\n> [API](#api) section for more details.\n\n## API\n\nThe following are exported by this package:\n\n### WHATWG Fetch Standard\n\n- [fetch](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch)\n- [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request)\n- [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n- [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers)\n- [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData)\n- [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController)\n\n### Web Streams API\n\n- [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)\n- [WritableStream](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream)\n- [TransformStream](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream)\n\n### URL Standard\n\n- [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL)\n- [URLSearchParams](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)\n- [URLPattern](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern)\n\n### Data Types\n\n- [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob)\n- [File](https://developer.mozilla.org/en-US/docs/Web/API/File)\n\n### Data Encoding/Decoding API\n\n- [TextEncoder](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder)\n- [TextDecoder](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder)\n- [btoa](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa)\n\n### Create variations of the implementation\n\n- `createFetch`\n\n`createFetch` allows you to create an API with some specific flags that are not available in the\nactual API.\n\n#### Limit the multipart form data size\n\nThis is useful if you parse the multipart request bodies with `.formData()`.\n\n```ts\nimport { createFetch } from '@whatwg-node/fetch'\n\nconst fetchAPI = createFetch({\n  formDataLimits: {\n    // Maximum allowed file size (in bytes)\n    fileSize: 1000000,\n    // Maximum allowed number of files\n    files: 10,\n    // Maximum allowed size of content (operations, variables etc...)\n    fieldSize: 1000000,\n    // Maximum allowed header size for form data\n    headerSize: 1000000\n  }\n})\n\n// See how you can handle file uploads with Fetch API\nhttp.createServer(async (req, res) => {\n  const request = new Request(req)\n  const formData = await request.formData()\n  const file = formData.get('file')\n  // ...\n})\n```\n","publish_time":1790804980369,"_cnpm_publish_time":1790804980369,"dist-tags":{"alpha":"0.12.2-alpha-20261016152556-c010d8f0d71d06c4adbe6a175d962956fddead77","latest":"0.12.1","rc":"0.12.1-rc-20260930212721-704975c3a29e2ac12b5fa09a53f1bbb7d4ccdf96"}}