module Roda::RodaPlugins::SinatraHelpers::ResponseMethods

def attachment(filename = nil, disposition=ATTACHMENT)

instructing the user agents to prompt to save.
Set the Content-Disposition to "attachment" with the specified filename,
def attachment(filename = nil, disposition=ATTACHMENT)
  if filename
    params = "; filename=#{File.basename(filename).inspect}"
    unless @headers[CONTENT_TYPE]
      ext = File.extname(filename)
      unless ext.empty?
        content_type(ext)
      end
    end
  end
  @headers[CONTENT_DISPOSITION] = "#{disposition}#{params}"
end