instance method stream

Ruby on Rails 7.0.10

Since v5.2.8.1 Last seen in v8.0.4 Private

Available in: v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4

Signature

stream(key)

Reads the object for the given key in chunks, yielding each to the block.

Parameters

key req
Source
# File activestorage/lib/active_storage/service/azure_storage_service.rb, line 160
      def stream(key)
        blob = blob_for(key)

        chunk_size = 5.megabytes
        offset = 0

        raise ActiveStorage::FileNotFoundError unless blob.present?

        while offset < blob.properties[:content_length]
          _, chunk = client.get_blob(container, key, start_range: offset, end_range: offset + chunk_size - 1)
          yield chunk.force_encoding(Encoding::BINARY)
          offset += chunk_size
        end
      end

Defined in activestorage/lib/active_storage/service/azure_storage_service.rb line 160 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveStorage::Service::AzureStorageService

Type at least 2 characters to search.

↑↓ navigate · open · esc close