app/controllers/proxy_controller.rb
##
# Stream a range request for download
# rubocop:disable Metrics/AbcSize
Stream a range request for download
rubocop:disable Metrics/AbcSize
Stream a range request for download rubocop : disable Metrics / AbcSize
def stream_range(blob, chunksize: 5.megabytes)
    ranges = header_ranges(blob.byte_size)
    set_content_range_header(ranges.first, blob.byte_size)
    ranges.each do |range|
      range.step(chunksize) do |start|
        chunk_end = [start + chunksize - 1, range.end].min
        response.stream.write blob.service.download_chunk blob.key, start..chunk_end
      end
    end
  ensure
    response.stream.close
  end
def stream_range ( blob , chunksize : 5 . megabytes ) ranges = header_ranges ( blob . byte_size ) set_content_range_header ( ranges . first , blob . byte_size ) ranges . each do | range | range . step ( chunksize ) do | start | chunk_end = [ start + chunksize - 1 , range . end ] . min response . stream . write blob . service . download_chunk blob . key , start .. chunk_end end end ensure response . stream . close end
Stream a range request for download
rubocop:disable Metrics/AbcSize
Stream a range request for download rubocop : disable Metrics / AbcSize
blob
<not_specific>
chunksize
<not_specific>
megabytes
<not_specific>