method
send_data
v2.1.0 -
Show latest stable
-
0 notes -
Class: ActionController::Streaming
- 1.0.0 (0)
- 1.1.6 (3)
- 1.2.6 (0)
- 2.0.3 (0)
- 2.1.0 (0)
- 2.2.1 (0)
- 2.3.8 (14)
- 3.0.0 (0)
- 3.0.9 (-1)
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
send_data(data, options = {})
protected
Send binary data to the user as a file download. May set content type, apparent file name, and specify whether to show data inline or download as an attachment.
Options:
- :filename - suggests a filename for the browser to use.
- :type - specifies an HTTP content type. Defaults to ‘application/octet-stream’.
- :disposition - specifies whether the file will be shown inline or downloaded. Valid values are ‘inline’ and ‘attachment’ (default).
- :status - specifies the status code to send with the response. Defaults to ‘200 OK’.
Generic data download:
send_data buffer
Download a dynamically-generated tarball:
send_data generate_tgz('dir'), :filename => 'dir.tgz'
Display an image Active Record in the browser:
send_data image.data, :type => image.content_type, :disposition => 'inline'
See send_file for more information on HTTP Content-* headers and caching.