Socket
Socket
Sign inDemoInstall

retry-me

Package Overview
Dependencies
2
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    retry-me

Single export interface to the retry module


Version published
Weekly downloads
4
increased by300%
Maintainers
1
Install size
25.6 kB
Created
Weekly downloads
 

Readme

Source

retry-me

Single export interface to the retry module

build status

Example

var retryMe = require('retry-me')
var request = require('request')

var fn = function(callback) {
  request('http://bluthipsum.com', function(err, res, body) {
    if (!err && res.statusCode !== 200) {
      err = new Error('Request failed with ' + res.statusCode)
    }
    callback(err, body)
  })
}

retryMe(fn, function(err, body, errors) {
  console.log(body)
})

You can also provide retry options:

var options = {
  retries: 2,
  factor: 2,
  minTimeout: 1000,
  maxTimeout: 2000,
  randomize: true
}

retryMe(fn, options, function(err, body, errors) {
  console.log(body)
})

License

MIT

Keywords

FAQs

Last updated on 27 Sep 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc