{"id":47597,"library":"fetch-helper-x","title":"fetch-helper-x","description":"Minimal Fetch API utility library for Node.js >=20 and browsers. Provides timeout and retry wrappers around the native fetch. Current version 0.1.8, pre-v1 release with infrequent updates. Differentiates by being TypeScript-first, zero-dependency, and supporting both Node.js built-in fetch (no polyfill needed) and browser environments via the same API. No dependency on node-fetch or undici.","status":"active","version":"0.1.8","language":"javascript","source_language":"en","source_url":"https://github.com/magiclen/ts-fetch-helper","tags":["javascript","http","fetch","request","timeout","retry","typescript"],"install":[{"cmd":"npm install fetch-helper-x","lang":"bash","label":"npm"},{"cmd":"yarn add fetch-helper-x","lang":"bash","label":"yarn"},{"cmd":"pnpm add fetch-helper-x","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export does not exist; named export only. ESM-only package, CJS require() will fail.","wrong":"import timeoutFetch from 'fetch-helper-x'","symbol":"timeoutFetch","correct":"import { timeoutFetch } from 'fetch-helper-x'"},{"note":"This package is ESM-only (node>=20), do not use require(). TypeScript types included.","wrong":"const { retryFetch } = require('fetch-helper-x')","symbol":"retryFetch","correct":"import { retryFetch } from 'fetch-helper-x'"},{"note":"Use type import to avoid runtime inclusion in TypeScript.","wrong":"import { TimeoutFetchOptions } from 'fetch-helper-x'","symbol":"TimeoutFetchOptions","correct":"import type { TimeoutFetchOptions } from 'fetch-helper-x'"}],"quickstart":{"code":"import { timeoutFetch, retryFetch } from 'fetch-helper-x';\n\nconst url = 'https://api.example.com/data';\n\n// Simple timeout fetch\nconst res1 = await timeoutFetch(url, { requestTimeout: 5000 });\nconst data1 = await res1.json();\nconsole.log(data1);\n\n// Retry with exponential backoff\nconst res2 = await retryFetch(url, { retries: 3, retryDelay: 1000 });\nconst data2 = await res2.json();\nconsole.log(data2);\n\n// Remember to cancel body to avoid hanging\nawait res2.cancelBody();","lang":"typescript","description":"Demonstrates timeoutFetch and retryFetch with JSON parsing, and the importance of canceling the response body to prevent memory leaks."},"warnings":[{"fix":"Always call `await response.cancelBody()` after processing the response body, or handle the response as a stream.","message":"After reading the response body (e.g., .text() or .json()), the underlying AbortController and timers are not automatically cleaned up; you must call .cancelBody() to avoid resource leaks.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use `import` syntax and upgrade Node.js to >=20.","message":"Package is ESM-only and requires Node.js >=20. Using require() or older Node versions will throw an error.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Pin to exact version or be prepared to adapt changes on minor/patch updates.","message":"Version 0.x is considered pre-release; the API may change without major semver bump.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"If you need to fully abort the request, combine with AbortController manually.","message":"The `requestTimeout` option in timeoutFetch does not cancel the request; only the response waiting time is limited. The fetch operation continues unless AbortController signal is used, but this library does not expose that signal.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.1.8':26 '20':12 'api':7,60 'around':20 'browser':14,55 'built':48 'built-in':47 'current':24 'depend':42,62 'differenti':34 'environ':56 'fetch':2,6,23,50,66,71 'fetch-helper-x':1 'first':39 'helper':3 'http':70 'infrequ':32 'javascript':69 'librari':9 'minim':5 'nativ':22 'need':53 'node':65 'node-fetch':64 'node.js':11,46 'polyfil':52 'pre':28 'pre-v1':27 'provid':15 'releas':30 'request':72 'retri':18,74 'support':44 'timeout':16,73 'typescript':38,75 'typescript-first':37 'undici':68 'updat':33 'util':8 'v1':29 'version':25 'via':57 'wrapper':19 'x':4 'zero':41 'zero-depend':40","created_at":"2026-06-07T16:52:19.908773+00:00","updated_at":"2026-06-07T16:52:19.908773+00:00","problems":[{"fix":"import { timeoutFetch } from 'fetch-helper-x'","cause":"Using default import instead of named import.","error":"SyntaxError: The requested module 'fetch-helper-x' does not provide an export named 'timeoutFetch'"},{"fix":"Use `import('fetch-helper-x')` dynamic import or switch to ESM syntax.","cause":"Using require() instead of import.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Upgrade Node to >=20 or use a fetch polyfill like undici.","cause":"Native fetch not available in Node <20, and this library does not polyfill.","error":"fetch is not defined (in Node <20)"}],"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://magiclen.org/fetch-helper/","github":"https://github.com/magiclen/ts-fetch-helper","docs":null,"changelog":null,"pypi":null,"npm":"fetch-helper-x","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}}