retry licenses

A tiny utility for exponentially retrying



This is free to use software, but if you do like it, consider supporting me ❤️

sponsor me buy me a coffee

⚙️ Install

Avaliable on jsr, NPM and deno.land

npm add rtri
npx jsr add @mr/retry

🚀 Usage

import { retry } from 'rtri';
// or
import { retry } from 'https://deno.land/x/rtri';

const get_data = await retry(
    async () => {
        const response = await fetch('https://example.com');
        if (!response.ok) throw new Error('not ok');
        return response.json();
    },
    { attempts: 3 },
);

await get_data();

License

MIT © Marais Rossouw