auto-retryer

1.0.0 • Public • Published

auto-retryer

extend the automatic retry function for the Promise function

Build Setup

# install dependencies
npm install auto-retryer --save
 
# node test
cd node_modules/auto-retryer
npm run test

Usage

const AutoRetryer = require('auto-retryer')
const _fetch = require('node-fetch')
 
//max retry 3 time
//sleep 300ms before retry
var fetch = new AutoRetryer(_fetch,3,300)
 
fetch('http://example.com',{method:'GET'}).then(ret=>{
    console.log('succcess',ret)
}).catch(err=>{
    console.log('err',err)
})

Package Sidebar

Install

npm i auto-retryer

Weekly Downloads

6

Version

1.0.0

License

MIT

Unpacked Size

3.58 kB

Total Files

6

Last publish

Collaborators

  • hjmmc