Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@osskit/fetch-enhancers

Package Overview
Dependencies
Maintainers
0
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@osskit/fetch-enhancers

  • 4.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

fetch-enhancers logo

A collection of composable enhancers on top of standard JS FetchAPI.

Bring your own FetchAPI implementation :pray:

Install

yarn add @osskit/fetch-enhancers

Usage

import { withTimeout, withRetry } from '@osskit/fetch-enhancers';

const fetchWithTimeout = withTimeout(fetch, {
  requestTimeoutMs: 5000,
}); // *optional* global options 5 seconds timeout

const fetchWithRetry = withRetry(fetch, {
  retries: 3,
  minTimeout: 1000, // In ms
  maxTimeout: 5000, // In ms
  factor: 5,
  randomize: false,
}); // *optional* global options object is async-retry's options object

// Compose enhancers:

const fetchWithRetryAndTimeout = withRetry(
  withTimeout(fetch, {
    requestTimeoutMs: 5000,
  }),
  {
    minTimeout: 1000, // In ms
    retries: 3,
    factor: 5,
  },
);

FAQs

Package last updated on 08 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc