instance method
download_and_verify_tempfile
Ruby on Rails edge
Since edge Private — implementation detail, not part of the public APISignature
download_and_verify_tempfile(key, checksum: nil, verify: true, name: "ActiveStorage-", tmpdir: nil, &block)
No documentation comment.
Parameters
-
keyreq -
checksumkey = nil -
verifykey = true -
namekey = "ActiveStorage-" -
tmpdirkey = nil -
blockblock
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