Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
transform objects to http responses with configurable retry strategy
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
example
lib
test
.gitignore
.travis.yml
Gruntfile.js
LICENSE
README.md
package.json

README.md

web-stream

Build Status

Transform objects to http responses with configurable retry strategy.

Construct the stream:

 new WebStream([{[maxBackoff,[shouldRetry]]}])

Where maxBackoff is the maximum amount of time to wait between retries (i.e. 3000 is 3 seconds), shouldRetry is a function with three arguments (err, res, body) and returns a boolean truth-y to retry false-y to continue.

Wire it to another stream for input that sends in:

 {
   url : 'http://some/url',
   method : 'GET'
 }

For HTTP methods that make sense you may also send in: 'body' and 'header' attributes in this object.

Which will be passed to request as it's options paramter.

web-stream is compatible with 0.8 node via the readable-stream module.

run the example:

 $ npm install
 $ cd example ; node .

Contributing

Run the tests:

grunt
Something went wrong with that request. Please try again.