lib-stream-http
v0.0.3
Published
create a duplex stream representing the http connection
Downloads
32
Readme
lib-stream-http
create a duplex stream representing the http connection
install
npm install --save lib-stream-http
usage
var Requestor = require('lib-stream-http')();
var requestor = Requestor.New();
var opts = {
host: 'myhost.example.com',
path: '/somet/path',
}
var duplex = requestor.newDuplex(opts);
// generate error on http status >= 400
// you should still consume the res
duplex.on('error', function (err, res) {
// cleanup on error
});
// the outStream only gets data if the request succeeds
inStream.pipe(duplex).pipe(outStream);
limitations
- does not handle
3xx
status codes