I'd like to generate a large blob of JSON and I also want to compress it at the same time. Right now I can do this:
json = JSON.generate(data)
result = Zlib.gzip(json)
Is it possible to avoid this intermediate variable and pass in a gzip IO so generation streams right into compression? Would it be reasonable to build in easy/efficient gzip integration, e.g. for streaming API/JSON responses with Content-Encoding: gzip?