express-http-proxy icon indicating copy to clipboard operation
express-http-proxy copied to clipboard

Modifying responses without buffering the entire response

Open kaysond opened this issue 7 years ago • 1 comments

Modifying responses using transform streams offers much better performance than buffering the whole response. So I wrote a connect/express middleware that makes it easy to do so. The module overwrites the response.write(), response.writeHead(), and response.end() methods, and instead first pipes the response through various streams (including decompression and compression, if necessary) that are attached the response object. I thought I'd share it with you as you may want to consider adding something similar for more efficient response modification.

https://github.com/kaysond/http-proxy-interceptor

kaysond avatar Oct 23 '18 19:10 kaysond

@kaysond Thanks, this is fascinating.

monkpow avatar Oct 24 '18 20:10 monkpow