module Carrierwave::Mongoid::File::Seek

Constants

VERSION

Public Class Methods

content_as_string(file, offset, io_seek) click to toggle source
# File lib/carrierwave/mongoid/file/seek.rb, line 7
def self.content_as_string(file, offset, io_seek)
  tempfile = Tempfile.new file.hash.to_s
  tempfile.binmode
  tempfile.write file.read
  tempfile.seek(offset, io_seek)
  content = tempfile.read
  tempfile.close
  tempfile.unlink
  content
end