I want to send binary data from a Sinatra application so that the user can download it as a file.
I tried using send_databut it gives me an undefined
send_data
undefined
The current version of Sinatra has a way to stream data:
get '/' do stream do |out| out << "It's gonna be legen -\n" sleep 0.5 out << " (wait for it) \n" sleep 1 out << "- dary!\n" end end
Source: http://www.sinatrarb.com/intro#Streaming%20Responses