方法
包含的模組
常數
DEFAULT_BLOB_STREAMING_DISPOSITION | = | "inline" |
執行個體私有方法
send_blob_stream(blob, disposition: nil) 連結
從儲存空間串流 Blob 直接到回應。可透過設定 disposition
控制配置。內容類型和檔名會直接從 blob
設定。
來源:顯示 | 在 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 rescue ActiveStorage::FileNotFoundError expires_now head :not_found rescue # Status and caching headers are already set, but not committed. # Change the status to 500 manually. expires_now head :internal_server_error raise end end