simple-get icon indicating copy to clipboard operation
simple-get copied to clipboard

support external piping

Open mafintosh opened this issue 7 years ago • 3 comments
trafficstars

Right now there doesn't seem to be a way to do

var req = get.post(...)

pump(coolStream, req)

Would be great to support that :)

mafintosh avatar May 11 '18 21:05 mafintosh

I added support for using readables as the body in https://github.com/feross/simple-get/pull/30. It's obviously not as elegant as piping to a stream returned by simple-get but that seemed like it would clash too much with the existing interface. At a bare minimum, streaming use can't call req.end. I think this would require a different method/option indicating that the user wants a writable stream.

bendrucker avatar May 11 '18 21:05 bendrucker

@bendrucker possible solution is to nextTick the req.end() and if req.on('pipe') fires inbetween cancel it.

mafintosh avatar May 11 '18 21:05 mafintosh

Mmm good point!

bendrucker avatar May 11 '18 21:05 bendrucker