/reliable-fetch

An easy-to-use Node.js library to make the Fetch API more reliable with timeouts, retries, and more.

Primary LanguageTypeScriptMIT LicenseMIT

Reliable Fetch

An easy-to-use Node.js library to make the Fetch API more reliable with timeouts, retries, and more.

import reliableFetch from '@hachibu/reliable-fetch'

async function main() {
    const timeout = 10 // milliseconds

    await reliableFetch('https://google.com')
        .on('timeout', () => console.log('timeout triggered'))
        .timeout({ timeout })
        .catch(console.log)
}

✨ Features

  • Timeouts
  • Retries with caps, backoff and jitter
  • Hedged requests
  • Random chaos
  • Lifecycle hooks

📖 Documentation

💻 Examples

📦 NPM Package