0

I have an HTTP enabled function, Node.js, that returns a big JSON (about 1.2 MB). Is there any way to compress that before sending to browser? I'm aware of Node module zlib, but I'm wondering if there is a predefined way to do that in actions. I haven't found anything about it in IBM or OpenWhisk docs

EDIT:
In my tests I have inspected request headers, the browser offers accept-encoding: gzip, deflate, br as usual

pierpy
  • 897
  • 3
  • 14
  • 18
  • Do you want the client to transparently receive the compressed results or require the client to decompress them in the client app? Shouldn't that be handled in the transport layer itself? – data_henrik Jan 17 '23 at 11:25
  • @data_henrik yes, I need something like `Content-Encoding: gzip` , and then on client side decompress the data. It's just for saving bandwidth... By the way, I know I can write myself some sort of "middleware" before returning response. Actually, automatic response type is `application/json` – pierpy Jan 17 '23 at 13:01

0 Answers0