A lightweight load-balanced fetch wrapper that distributes HTTP requests across multiple server URLs. v1.1.0 supports both string and URL inputs, configurable balancer strategies (default random shuffle), and custom success predicates. Works with any fetch-compatible environment (Node.js, browser, Deno) and includes TypeScript types. Differs from traditional load balancers by providing client-side, application-level fallback: if one endpoint fails (throws or returns a server error >=500), it automatically tries the next URL.
npm install lb-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage with custom balancer and success predicate, including fallback between two servers.
Use dynamic import in CommonJS: `const lbFetch = await import('lb-fetch')`, or migrate to ESM.Pass a custom balancer that handles your input type: `lbFetch(input, init, { balancer: myBalancer })`.Override the success predicate to define your own success criteria, e.g., `(res) => res.ok`.
Stay updated with the package changelog.
Change to `import lbFetch from 'lb-fetch'` or use dynamic import.
Use `import lbFetch from 'lb-fetch'`.
Provide a `balancer` option in the third argument.
Pass the fetch implementation explicitly via `options.fetch`, or use a polyfill like `node-fetch`.
No dependency data recorded yet.