module Shrine::Plugins::DataUri::FileMethods
Public Instance Methods
Source
# File lib/shrine/plugins/data_uri.rb 169 def base64 170 binary = open { |io| io.read } 171 result = Base64.strict_encode64(binary) 172 binary.clear # deallocate string 173 result 174 end
Returns contents of the file base64-encoded.
Source
# File lib/shrine/plugins/data_uri.rb 164 def data_uri 165 @data_uri ||= "data:#{mime_type || "text/plain"};base64,#{base64}" 166 end
Returns the data URI representation of the file.