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

node-fetch-backoff

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-fetch-backoff

A persistent version of fetch

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Basic usage example

Build Status Coverage Status

const nfbFactory = require('node-fetch-backoff');
const fetch = nfbFactory({
    // Msec or function. Default is exponential delay using msec from this option.
    delay: 10 * 1000,

    // Default is 5 retries before giving up
    retries: 5,

    // Default is a function that reads the ok property of the response object.
    // The function gets passed the response.
    isOK: (resp) => resp.ok,

    // Function that gets the error passed in to deside if it should retry.
    shouldRetryError: (error) => true,

    // Function that gets the response passed in to deside if it should retry.
    shouldRetryResponse = () => true,

    // The fetch implementation to use. If not provided it will require node-fetch.
    fetch: undefined,
});

// Follows the https://www.npmjs.com/package/node-fetch implementation.
const res = await fetch('/test.json');

FAQs

Package last updated on 21 Apr 2022

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