Skip to Content Skip to Search

module ActiveStorage::Streaming

Inherits From

Constants

DEFAULT_BLOB_STREAMING_DISPOSITION

"inline"

Private instance methods

send_blob_stream(blob, disposition: nil)

Permalink

Stream the blob from storage directly to the response. The disposition can be controlled by setting disposition. The content type and filename is set directly from the blob.

Source code GitHub
# File activestorage/app/controllers/concerns/active_storage/streaming.rb, line 56
def send_blob_stream(blob, disposition: nil) # :doc:
  send_stream(
      filename: blob.filename.sanitized,
      disposition: blob.forced_disposition_for_serving || disposition || DEFAULT_BLOB_STREAMING_DISPOSITION,
      type: blob.content_type_for_serving) do |stream|
    blob.download do |chunk|
      stream.write chunk
    end
  end
end

Definition files