A lightweight HTTP request library (~6KB, Gzip ~3KB) built on the Fetch API with a plugin system and an API similar to axios. Current stable version is 0.8.3 (released August 2024), with frequent updates (multiple releases per month). Key differentiators: supports error retry, throttling, deduplication, and caching via plugins; works seamlessly in edge runtimes, Tauri, and traditional Node.js; has built-in cancelation via AbortController; and provides TypeScript types. Unlike axios, it does not rely on XMLHttpRequest, making it suitable for modern environments. However, it is not a drop-in replacement: error handling, response shape, and browser compatibility differ.
npm install xiorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows creating an instance with baseURL and timeout, making GET/POST requests, error handling, and interceptor usage.
Use a fetch polyfill like 'isomorphic-fetch' or 'node-fetch' in older environments, or switch to axios if full backward compatibility is required.
In catch blocks, check for error.response existence and then error.response.status. Use type narrowing: if (error instanceof xior.XiorError) { const err = error; ... }Consider using the community version 'xior-auth-refresh-plugin' for more stability, or pin exact version in package.json.
Check error.name === 'AbortError' to detect canceled requests.
Clone response data before caching or use the 'clone' option in cache plugin config.
Use: import xior from 'xior'
Install node-fetch and set global fetch: globalThis.fetch = require('node-fetch')Ensure your environment supports AbortSignal.timeout (Node >=15, modern browsers). Alternatively, use a polyfill.
Check if error.response exists before accessing properties: if (error.response) { console.log(error.response.status); }No dependency data recorded yet.