0.0.3 • Published 10 years ago

lib-stream-http v0.0.3

Weekly downloads
3
License
ISC
Repository
github
Last release
10 years ago

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

see also

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago