Gathering detailed insights and metrics for @ambassify/fetch-retried
Gathering detailed insights and metrics for @ambassify/fetch-retried
npm install @ambassify/fetch-retried
Typescript
Module System
Node Version
NPM Version
65.6
Supply Chain
92.5
Quality
79.6
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
36,853
Last Day
3
Last Week
19
Last Month
174
Last Year
2,270
3 Stars
25 Commits
2 Watching
1 Branches
3 Contributors
Minified
Minified + Gzipped
Latest Version
2.0.4
Package Id
@ambassify/fetch-retried@2.0.4
Unpacked Size
17.91 kB
Size
4.19 kB
File Count
11
NPM Version
9.3.1
Node Version
18.14.0
Publised On
03 Feb 2023
Cumulative downloads
Total Downloads
Last day
-87.5%
3
Compared to previous day
Last week
-79.8%
19
Compared to previous week
Last month
-13.4%
174
Compared to previous month
Last year
-59%
2,270
Compared to previous year
1
7
Use the fetch API to run requests, implementing retries
1npm install --save @ambassify/fetch-retried
You can use the fetch api as per usual. The only thing different is the source of your fetch method. Here you use fetchRetried to create a fetch method that will use your desired config.
1const fetchRetried = require('@ambassify/fetch-retried'); 2const fetch = fetchRetried({ delay: 100 }); 3 4fetch('https://www.google.com') 5 .then(resp => resp.json()) 6 .then(json => console.log(json));
All options are optional and have default values.
exponential
backoff, the delay used to calculate the timeout. Otherwise a method that calculated the timeout used. (default: 200
)5
)true
or false
when passed a response. (default: (resp) => resp.ok
)true
or false
(default: () => true
)['PUT', 'DELETE', 'GET', 'HEAD', 'PATCH', 'OPTIONS']
)require('node-fetch')
)Strategies are attached to the default import of this package and can be accessed using.
1const fetchRetried = require('@ambassify/fetch-retried'); 2 3fetchRetried.exponential; 4// OR 5fetchRetried.binaryExponential; 6 7// Usage: 8const fetch = fetchRetried({ 9 delay: fetchRetried.exponential(10) 10}) 11// OR 12const fetch = fetchRetried({ 13 delay: fetchRetried.binaryExponential() 14})
exponential
1function exponential(delay) { 2 return (attempts) => (attempts * attempts) * delay; 3}
binaryExponential
1function binaryExponential(delay = 1) { 2 return (attempts) => (Math.pow(2, attempts) - 1) * delay; 3}
We really appreciate any contribution you would like to make, so don't hesitate to report issues or submit pull requests.
This project is released under a MIT license.
If you would like to know more about us, be sure to have a look at our website, or our Twitter accounts Ambassify, Sitebase, JorgenEvens
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
branch protection is not maximal on development and all release branches
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/21 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More