instance method download_and_verify_tempfile

Ruby on Rails edge

Since edge Private — implementation detail, not part of the public API

Signature

download_and_verify_tempfile(key, checksum: nil, verify: true, name: "ActiveStorage-", tmpdir: nil, &block)

No documentation comment.

Parameters

key req
checksum key = nil
verify key = true
name key = "ActiveStorage-"
tmpdir key = nil
block block
Source
# File activestorage/lib/active_storage/service.rb, line 215
      def download_and_verify_tempfile(key, checksum: nil, verify: true, name: "ActiveStorage-", tmpdir: nil, &block)
        tempfile = Tempfile.new(name, tmpdir, binmode: true)
        download(key) { |chunk| tempfile.write(chunk) }
        tempfile.flush
        tempfile.rewind

        verify_integrity_of(tempfile, checksum: checksum) if verify
        if block_given?
          begin
            yield tempfile
          ensure
            tempfile.close!
          end
        else
          tempfile
        end
      end

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

Defined in ActiveStorage::Service

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close