module ActionController::Streaming
def send_data(data, options = {}) #:doc:
instead. See ActionController::Base#render for more information.
data to the browser, then use render :text => proc { ... }
Tip: if you want to stream large amounts of on-the-fly generated
See +send_file+ for more information on HTTP Content-* headers and caching.
send_data image.data, :type => image.content_type, :disposition => 'inline'
Display an image Active Record in the browser:
send_data generate_tgz('dir'), :filename => 'dir.tgz'
Download a dynamically-generated tarball:
send_data buffer
Generic data download:
* :status - specifies the status code to send with the response. Defaults to '200 OK'.
Valid values are 'inline' and 'attachment' (default).
* :disposition - specifies whether the file will be shown inline or downloaded.
either a string or a symbol for a registered type register with Mime::Type.register, for example :json
* :type - specifies an HTTP content type. Defaults to 'application/octet-stream'. You can specify
* :filename - suggests a filename for the browser to use.
Options:
the apparent file name, and other things.
download dialog) or as inline data. You may also set the content type,
the browser should display the response as a file attachment (i.e. in a
render :text => data, but also allows you to specify whether
Sends the given binary data to the browser. This method is similar to
def send_data(data, options = {}) #:doc: send_file_headers! options.dup render options.slice(:status, :content_type).merge(:text => data) end