I want to create a zip archive on the fly while streaming it over the new Rails Live API. My problem at this point isn't the creation of the zip and sending it to the browser. It's more the problem to creating the zip on-the-fly for sending it over the rails response stream. The rubyzip documentation doesn't seem to be very well in some points for the streams.
here is the code that already works for creating and sending the file to our server (it doesn't use the ActionController Live API).
t = File.open("#{path}/#{zipfile_name}", "w")
Zip::OutputStream.open(t.path) do |zos|
# recursive method for building the zip structure in our system
stream_files(zos, params[:files], folder, "")
end
send_file t.path, :type => 'application/zip',
:disposition => 'attachment',
:filename => "#{zipfile_name}.zip"
t.close
Has anyone the same problem and got solved it already?