{"name":"request-replay","version":"0.1.6","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"},"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","_id":"request-replay@0.1.6","dist":{"shasum":"d8e8915f720d06fdeb277971d67ccf52ca25ec3f","tarball":"http://registry-npm.ywwl.com/request-replay/download/request-replay-0.1.6.tgz","integrity":"sha512-u9pJzyQZMfDLbnmkcr56vXmZSzS8C6rp13tpv2DwM8RaQN0B8JnSWzTXKMW1o45fRAhHDQOXeqlWI0mobCHNWA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICMlxgSQoEfYkU6Weaz2qEtpxfZX6PiQmeYt+S/OiJBtAiEA78TnDH9ytF4MFCJKpwpb+OZUsRFCT29NBLbf7w1BCRA="}],"size":3661,"noattachment":false,"key":"/request-replay/-/request-replay-0.1.6.tgz"},"_from":".","_npmVersion":"1.3.2","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"directories":{},"readme":"# request-replay\n\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url]\n\n[npm-url]:https://npmjs.org/package/request-replay\n[downloads-image]:http://img.shields.io/npm/dm/request-replay.svg\n[npm-image]:http://img.shields.io/npm/v/request-replay.svg\n[travis-url]:https://travis-ci.org/IndigoUnited/node-request-replay\n[travis-image]:http://img.shields.io/travis/IndigoUnited/node-request-replay/master.svg\n[david-dm-url]:https://david-dm.org/IndigoUnited/node-request-replay\n[david-dm-image]:https://img.shields.io/david/IndigoUnited/node-request-replay.svg\n[david-dm-dev-url]:https://david-dm.org/IndigoUnited/node-request-replay#info=devDependencies\n[david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/node-request-replay.svg\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 with error codes that cause the replay to happen\n// Check out the code to see which is the default value for it\nreplay(request('http://google.com/doodle.png', { timeout: 10000 }, function (err, response, body) {\n    // Do things\n}), {\n    retries: 10,\n    factor: 3\n})\n.on('socket', function (socket) {\n    // In some operating systems the socket timeout is 0 so you must explicitly set it\n    // and close the socket once reached\n    socket.setTimeout(10000, socket.end.bind(socket));\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","publish_time":1375364537982,"_cnpm_publish_time":1375364537982,"dist-tags":{"latest":"1.0.4"}}