module Roda::RodaPlugins::SinatraHelpers::RequestMethods

def send_file(path, opts = OPTS)

Use the contents of the file at +path+ as the response body. See plugin documentation for options.
def send_file(path, opts = OPTS)
  res = response
  headers = res.headers
  if opts[:type] || !headers[RodaResponseHeaders::CONTENT_TYPE]
    res.content_type(opts[:type] || ::File.extname(path), :default => 'application/octet-stream')
  end
  disposition = opts[:disposition]
  filename    = opts[:filename]
  if disposition || filename
    disposition ||= 'attachment'
    filename = path if filename.nil?
    res.attachment(filename, disposition)
  end
  if lm = opts[:last_modified]
    last_modified(lm)
  end
  file = RACK_FILES.new nil
  s, h, b = if Rack.release > '2'
    file.serving(self, path)
  else
    file.path = path
    file.serving(@env)
  end
  res.status = opts[:status] || s
  headers.delete(RodaResponseHeaders::CONTENT_LENGTH)
  headers.replace(h.merge!(headers))
  res.body = b
  halt
rescue Errno::ENOENT
  not_found
end