I am trying to write a ruby fcgi script that compresses files in a directory on the fly and sends the output block by block as an HTTP response. It is very important that this compression is performed as a stream operation, otherwise the client will receive a timeout for huge directories.
I have the following code:
d="/tmp/delivery/" # send zip header header(MimeTypes::ZIP) # pseudocode from here on IO.open(d) { |fh| block=fh.readblock(1024) #send zipped block as http response print zip_it(block) }
How to achieve what I wrote in a pseudo-ruby in the above list?
gorootde
source share