open-index/open-npm huggingface dataset:
npm package: @plantae/plugin-retry
Description: Retry plugin for Plantae.
Latest version: 0.1.1

# @plantae/plugin-retry

Retry plugin for Plantae.

It's highly inspired by [Ky's retry](https://github.com/sindresorhus/ky#retry)

## Installation

```bash
# npm
npm install @plantae/plugin-retry

# yarn
yarn add @plantae/plugin-retry
```

## Usage

```ts
import retryPlugin from "@plantae/plugin-retry";

const fetchWithRetry = createFetch({
  client: fetch,
  plugins: [retryPlugin(3)], // retry 3 times
});
```

Or, you can pass the options:

```ts
const fetchWithRetry = createFetch({
  client: fetch,
  plugins: [
    retryPlugin({
      limit: 3,
      methods: ["GET", "POST"],
      statusCodes: [408, 429],
      maxRetryAfter: 1000,
      backoffLimit: 10000,
    }),
  ],
});
```

## Options

```ts
type PluginOptions =
  | {
      // default: 2
      limit?: number;

      // default: ["GET", "PUT", "HEAD", "OPTIONS", "DELETE"]
      methods?: string[];

      // default: [408, 413, 429, 500, 502, 503, 504]
      statusCodes?: number[];

      // default: undefined
      maxRetryAfter?: number;

      // default: undefined
      backoffLimit?: number;
    }
  | number;
```
npm package: @plantae/plugin-timeout
Description: Timeout plugin for Plantae.
Latest version: 0.1.2

# @plantae/plugin-timeout

Timeout plugin for Plantae.

## Installation

```bash
# npm
npm install @plantae/plugin-timeout

# yarn
yarn add @plantae/plugin-timeout
```

## Usage

```ts
import timeoutPlugin from "@plantae/plugin-timeout";

const fetchWithTimeout = createFetch({
  client: fetch,
  plugins: [timeoutPlugin(5000)], // timeout after 5 seconds
});
```