Skip to content

Instantly share code, notes, and snippets.

@dhruvasagar
Created December 29, 2011 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dhruvasagar/1532564 to your computer and use it in GitHub Desktop.
Save dhruvasagar/1532564 to your computer and use it in GitHub Desktop.
Sinatra File Server for serving Videos
APP_ROOT = File.expand_path('.')
require 'sinatra'
get '*' do
mimetype = `file -ib #{File.join(APP_ROOT, params[:splat].join)}`.gsub(/\n/,"")
content_type mimetype
send_file File.join(APP_ROOT, params[:splat].join)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment