Sha256: 3f8ec4812cc2b8dba954cdae5eb20efa5e8c797163c66475355bd7521513e432
Contents?: true
Size: 528 Bytes
Versions: 7
Compression:
Stored size: 528 Bytes
Contents
module Innate module Helper module SendFile # Not optimally performing but convenient way to send files by their # filename. def send_file(filename, content_type = nil) content_type ||= Rack::Mime.mime_type(::File.extname(filename)) response.body = ::File.readlines(filename, 'rb') response['Content-Length'] = ::File.size(filename).to_s response['Content-Type'] = content_type response.status = 200 throw(:respond, response) end end end end
Version data entries
7 entries across 7 versions & 2 rubygems