Batch downloads in Ruby on Rails -


i've got ruby on rails app , wondering best way do batch downloads be? @ given time i've got set of urls point files want users able download, based on search of files done users want them able download subset of files, search result, in 1 process instead of having them download them individually. set of files may potentially number in thousands. real question is, based on array of urls, how enable app download entire set @ once? of course did googling , came solution below. doesn't seem work me, did seem work posted solution similar problem. , input appreciated.

# controller code def download    n in 0..(@urls.length - 1)       send_file(@urls[n], :type => "video/quicktime",                            :filename => @urls[n].basename,                            :disposition => "attachment")    end end  # view code <%= link_to 'download them all', :controller => 'my_controller',                                   :action => 'download' %> 

this approach seems me use huge amount of memory, 1000s of files downloaded per user @ time. perhaps instead should zip files in background after click link , send user or email them location of zip's at. it'll still use lot of memory zip many files, perhaps offloading task server good.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -