web-stream

0.0.2 • Public • Published

web-stream

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 .

Readme

Keywords

none

Package Sidebar

Install

npm i web-stream

Weekly Downloads

0

Version

0.0.2

License

BSD

Last publish

Collaborators

  • elee