ActionController::DataStreaming
Constants
DEFAULT_SEND_FILE_DISPOSITION = "attachment"
DEFAULT_SEND_FILE_TYPE = "application/octet-stream"
MIME_BY_EXT = {"html" => "text/html", "htm" => "text/html", "txt" => "text/plain", "css" => "text/css", "js" => "text/javascript", "mjs" => "text/javascript", "json" => "application/json", "pdf" => "application/pdf", "png" => "image/png", "jpg" => "image/jpeg", "jpeg" => "image/jpeg", "gif" => "image/gif", "svg" => "image/svg+xml", "webp" => "image/webp", "ico" => "image/vnd.microsoft.icon", "xml" => "application/xml", "csv" => "text/csv", "zip" => "application/zip", "gz" => "application/gzip", "tgz" => "application/gzip", "mp4" => "video/mp4", "webm" => "video/webm", "mp3" => "audio/mpeg", "wasm" => "application/wasm", "woff" => "font/woff", "woff2" => "font/woff2"} of String => String
Подмножество Rack::Mime для вывода типа по расширению.
Instance methods
send_data(data : String, filename : String | Nil = nil, type : String | Nil = nil, disposition : String | Nil = DEFAULT_SEND_FILE_DISPOSITION, status : Int32 | Symbol = 200, content_type : String | Nil = nil) : Nil
send_data "pdf!", filename: "report.pdf", type: "application/pdf"
send_file(path : String, filename : String | Nil = nil, type : String | Nil = nil, disposition : String | Nil = DEFAULT_SEND_FILE_DISPOSITION, status : Int32 | Symbol = 200, content_type : String | Nil = nil, url_based_filename : Bool = false) : Nil
send_file "/path/report.pdf", disposition: "inline", status: 404