instance method send_blob_stream

Ruby on Rails 7.2.3

Since v7.0.10 Private

Available in: v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

send_blob_stream(blob, disposition: nil)

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.

Parameters

blob req
disposition key = nil
Source
# 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

Defined in activestorage/app/controllers/concerns/active_storage/streaming.rb line 56 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveStorage::Streaming

Type at least 2 characters to search.

↑↓ navigate · open · esc close