{ "name": "request-replay", "version": "0.2.0", "description": "Replays a request when a network error occurs", "main": "index.js", "dependencies": { "retry": "~0.6.0" }, "devDependencies": { "mocha": "~1.12.0", "expect.js": "~0.2.0", "request": "~2" }, "scripts": { "test": "mocha -R spec" }, "repository": { "type": "git", "url": "git://github.com/IndigoUnited/node-request-replay.git" }, "bugs": { "url": "http://github.com/IndigoUnited/node-request-replay/issues" }, "keywords": [ "retry", "replay", "request", "mikeal", "network" ], "author": { "name": "IndigoUnited", "email": "hello@indigounited.com", "url": "http://indigounited.com" }, "license": "MIT", "readme": "# request-replay [![Build Status](https://secure.travis-ci.org/IndigoUnited/node-request-replay.png)](http://travis-ci.org/IndigoUnited/node-request-replay.png)\n\nReplays a [request](https://github.com/mikeal/request) when a network error occurs using the [retry](https://github.com/felixge/node-retry) module.\n\n**DO NOT** use this module if you are piping `request` instances.\nIf you are listening to `data` events to buffer, beware that you must reset everything when a `replay` occurs.\nThis is why `pipping` is not supported.\n\n\n## Installation\n\n`$ npm install request-replay`\n\n\n## Usage\n\n```js\nvar fs = require('fs');\nvar request = require('request');\nvar replay = require('request-replay');\n\n// Note that the options argument is optional\n// Accepts the same options the retry module does and an additional\n// errorCodes array that default to ['EADDRINFO', 'ETIMEDOUT', 'ECONNRESET', 'ESOCKETTIMEDOUT']\nreplay(request('http://google.com/doodle.png', function (err, response, body) {\n // Do things\n}), {\n retries: 10,\n factor: 3\n})\n.on('replay', function (replay) {\n // \"replay\" is an object that contains some useful information\n console.log('request failed: ' + replay.error.code + ' ' + replay.error.message);\n console.log('replay nr: #' + replay.number);\n console.log('will retry in: ' + replay.delay + 'ms')\n})\n```\n\nNote that the default retry options are modified to be more appropriate for requests:\n\n* `retries`: The maximum amount of times to retry the operation. Default is `5`.\n* `factor`: The exponential factor to use. Default is `2`.\n* `minTimeout`: The amount of time before starting the first retry. Default is `2000`.\n* `maxTimeout`: The maximum amount of time between two retries. Default is `35000`.\n* `randomize`: Randomizes the timeouts by multiplying with a factor between `1` to `2`. Default is `true`.\n\n\n## License\n\nReleased under the [MIT License](http://www.opensource.org/licenses/mit-license.php).\n", "readmeFilename": "README.md", "homepage": "https://github.com/IndigoUnited/node-request-replay#readme", "_id": "request-replay@0.2.0", "_shasum": "9b693a5d118b39f5c596ead5ed91a26444057f60", "_resolved": "https://registry.npmjs.org/request-replay/-/request-replay-0.2.0.tgz", "_from": "request-replay@>=0.2.0 <0.3.0" }