{"id":47539,"library":"extra-fetch","title":"extra-fetch","description":"A drop-in replacement for the global fetch API in Node.js, providing enhanced features such as HTTP/2 support, logging, and compatibility with experimental fetch implementations. Version 5.2.0 requires Node.js >=22 and ships TypeScript types. The library exports the standard fetch, Headers, Request, Response, FormData, AbortController, Blob, and EventSource, with HTTP/2 enabled by default and configurable logging via environment variables. It differentiates itself by offering a seamless upgrade path for Node.js fetch with minimal configuration.","status":"active","version":"5.2.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/BlackGlory/extra-fetch","tags":["javascript","typescript"],"install":[{"cmd":"npm install extra-fetch","lang":"bash","label":"npm"},{"cmd":"yarn add extra-fetch","lang":"bash","label":"yarn"},{"cmd":"pnpm add extra-fetch","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Named export, not default. ESM-only; this package does not support CommonJS require.","wrong":"import fetch from 'extra-fetch'","symbol":"fetch","correct":"import { fetch } from 'extra-fetch'"},{"note":"Named export. Because the package is ESM-only, require() will throw an error.","wrong":"const { Headers } = require('extra-fetch')","symbol":"Headers","correct":"import { Headers } from 'extra-fetch'"},{"note":"Named export; not default. Use named import syntax.","wrong":"import Response from 'extra-fetch'","symbol":"Response","correct":"import { Response } from 'extra-fetch'"},{"note":"Named export. Available since v5.0.0.","wrong":null,"symbol":"EventSource","correct":"import { EventSource } from 'extra-fetch'"}],"quickstart":{"code":"import { fetch, Headers, Response } from 'extra-fetch';\n\nasync function main() {\n  const url = 'https://api.example.com/data';\n  const headers = new Headers();\n  headers.set('Content-Type', 'application/json');\n  headers.set('Authorization', `Bearer ${process.env.API_KEY ?? ''}`);\n\n  const response = await fetch(url, {\n    method: 'GET',\n    headers\n  });\n\n  if (!response.ok) {\n    console.error('Request failed:', response.statusText);\n    return;\n  }\n\n  const data = await response.json();\n  console.log('Data:', data);\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Demonstrates basic usage of enhanced fetch with custom headers and async/await error handling."},"warnings":[{"fix":"Upgrade Node.js to v22 or later.","message":"Requires Node.js >=22. Older Node.js versions are not supported.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Use import syntax instead. If you must use require, use dynamic import: const { fetch } = await import('extra-fetch')","message":"ESM-only package. CommonJS require() does not work.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Set environment variable EXTRA_FETCH_HTTP2=false to disable HTTP/2.","message":"HTTP/2 is enabled by default in Node.js. This may cause unexpected behavior with HTTP/1.1-only servers.","severity":"gotcha","affected_versions":">=5.0.0"}],"env_vars":null,"search_vec":"'22':34 '5.2.0':31 'abortcontrol':49 'api':13 'blob':50 'compat':25 'configur':59,78 'default':57 'differenti':65 'drop':6 'drop-in':5 'enabl':55 'enhanc':17 'environ':62 'eventsourc':52 'experiment':27 'export':41 'extra':2 'extra-fetch':1 'featur':18 'fetch':3,12,28,44,75 'formdata':48 'global':11 'header':45 'http/2':21,54 'implement':29 'javascript':79 'librari':40 'log':23,60 'minim':77 'node.js':15,33,74 'offer':68 'path':72 'provid':16 'replac':8 'request':46 'requir':32 'respons':47 'seamless':70 'ship':36 'standard':43 'support':22 'type':38 'typescript':37,80 'upgrad':71 'variabl':63 'version':30 'via':61","created_at":"2026-06-07T16:52:01.567119+00:00","updated_at":"2026-06-07T16:52:01.567119+00:00","problems":[{"fix":"Ensure your project is configured as ESM (type: 'module' in package.json) or use dynamic import.","cause":"Running in a CommonJS environment without proper ESM configuration.","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"Ensure you import Headers as a named import and use 'new Headers()'.","cause":"Using Headers as a function without the 'new' keyword, or incorrect import.","error":"TypeError: Class constructor Headers cannot be invoked without 'new'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/BlackGlory/extra-fetch#readme","github":"ssh://git@github.com/BlackGlory/extra-fetch","docs":null,"changelog":null,"pypi":null,"npm":"extra-fetch","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}