module Sinatra::Helpers
def send_file(path, opts={})
def send_file(path, opts={}) stat = File.stat(path) last_modified stat.mtime content_type media_type(opts[:type]) || media_type(File.extname(path)) || response['Content-Type'] || 'application/octet-stream' response['Content-Length'] ||= (opts[:length] || stat.size).to_s halt StaticFile.open(path, 'rb') rescue Errno::ENOENT not_found end