{"id":49825,"library":"za-fetch-api","title":"za-fetch-api","description":"A lightweight, Fetch API-like wrapper for making AJAX requests in Node.js or the browser, currently at version 2.7.2. Provides a familiar fetch-style interface with extended options like request cancellation, retries, timeout, and interceptors. Maintained actively with monthly releases. Differentiates itself from similar libraries (e.g., axios, ky) by its minimal overhead and strict adherence to the Fetch API specification, while adding ergonomic features for error handling and response transformation.","status":"active","version":"2.7.2","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install za-fetch-api","lang":"bash","label":"npm"},{"cmd":"yarn add za-fetch-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add za-fetch-api","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export not available. Use named import.","symbol":"zaFetch","correct":"import { zaFetch } from 'za-fetch-api'"},{"note":"Factory function to create a custom instance with base config.","symbol":"createZaFetch","correct":"import { createZaFetch } from 'za-fetch-api'"},{"note":"Error class for request failures.","symbol":"ZaFetchError","correct":"import { ZaFetchError } from 'za-fetch-api'"}],"quickstart":{"code":"import { zaFetch } from 'za-fetch-api';\n\nasync function fetchData() {\n  try {\n    const response = await zaFetch('https://api.example.com/data', {\n      method: 'GET',\n      headers: { 'Content-Type': 'application/json' },\n      retries: 3,\n      retryDelay: 1000,\n      timeout: 5000,\n    });\n    const data = await response.json();\n    console.log(data);\n  } catch (error) {\n    if (error instanceof ZaFetchError) {\n      console.error('Request failed:', error.message);\n    }\n  }\n}\n\nfetchData();","lang":"typescript","description":"Shows basic GET request with retries and timeout using zaFetch, including error handling with ZaFetchError."},"warnings":[{"fix":"Upgrade Node.js to 14 or higher.","message":"Version 2.x dropped support for Node.js < 14.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Replace 'zaFetch(url, { interceptors: [...] })' with 'const client = createZaFetch({ interceptors: [...] }); client(url, ...)'.","message":"The 'interceptors' option in zaFetch is deprecated; use 'createZaFetch' with interceptors parameter.","severity":"deprecated","affected_versions":">=2.5.0"},{"fix":"Add option 'validateStatus: (status) => true' to treat all statuses as success.","message":"By default, zaFetch rejects on non-2xx status codes. To get the response regardless, pass 'validateStatus: () => true'.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Custom retry logic needed for HTTP errors; consider using interceptors to retry on specific status codes.","message":"When using 'retries', the library will retry on network errors only, not on HTTP errors (e.g., 4xx).","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Set timeout as the total maximum time per attempt; for a global timeout across retries, implement manual logic.","message":"The 'timeout' option is in milliseconds and will abort the request if not completed in time, but the timeout is reset on each retry attempt.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2.7.2':24 'activ':43 'ad':68 'adher':61 'ajax':14 'api':4,9,65 'api-lik':8 'axio':53 'browser':20 'cancel':37 'current':21 'differenti':47 'e.g':52 'ergonom':69 'error':72 'extend':33 'familiar':27 'featur':70 'fetch':3,7,29,64 'fetch-styl':28 'handl':73 'interceptor':41 'interfac':31 'javascript':77 'ky':54 'librari':51 'lightweight':6 'like':10,35 'maintain':42 'make':13 'minim':57 'month':45 'node.js':17 'option':34 'overhead':58 'provid':25 'releas':46 'request':15,36 'respons':75 'retri':38 'similar':50 'specif':66 'strict':60 'style':30 'timeout':39 'transform':76 'version':23 'wrapper':11 'za':2 'za-fetch-api':1","created_at":"2026-06-07T17:03:47.851754+00:00","updated_at":"2026-06-07T17:03:47.851754+00:00","problems":[{"fix":"Increase the timeout value or optimize the request.","cause":"The request took longer than the specified timeout.","error":"ZaFetchError: Request timed out after 5000ms"},{"fix":"Ensure the URL is a valid string: const response = await zaFetch('https://api.example.com');","cause":"The URL argument is undefined or null.","error":"TypeError: Failed to parse URL from undefined"},{"fix":"Check network connectivity and server availability; consider increasing retries or using exponential backoff.","cause":"All retry attempts failed due to network errors.","error":"Error: Too many retries, request failed"}],"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":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"za-fetch-api","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}}