First of all, how to create a simple file upload using Sinatra: Downloading a file using Sinatra
So now, to start your thin web server, you can do this in your code:
class MyWebApp < Sinatra::Base
thin uses eventmachine internally, I suppose webrick uses streams, but to be honest, I never looked at it.
You should use apache or nginx in front of your ruby ββprocess, at least to download the file (I think the web ports will not work through it). I can enable a simple nginx configuration if you need to (just need to find it on my xD drive).
Edit: Another solution is to use goliath as a web server, you have an example: https://github.com/postrank-labs/goliath/blob/master/examples/async_upload.rb If you do not need to show the download progress, you should stay with sinatra + nginx / apache.
source share