method

compute_checksum_in_chunks

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: Blob
compute_checksum_in_chunks(io) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activestorage/app/models/active_storage/blob.rb, line 333
    def compute_checksum_in_chunks(io)
      raise ArgumentError, "io must be rewindable" unless io.respond_to?(:rewind)

      OpenSSL::Digest::MD5.new.tap do |checksum|
        while chunk = io.read(5.megabytes)
          checksum << chunk
        end

        io.rewind
      end.base64digest
    end
Register or log in to add new notes.