class Fog::Storage::Local::Files
Public Instance Methods
get(key, &block)
click to toggle source
This method is exactly like the stock one except for using “rb” (force binary mode) instead of “r” for reading the file. On windows it defaults to text mode which messes everything up.
# File lib/right_publish/stores/local.rb, line 13 def get(key, &block) requires :directory path = file_path(key) if ::File.exists?(path) data = { :content_length => ::File.size(path), :key => key, :last_modified => ::File.mtime(path) } if block_given? file = ::File.open(path, "rb") while (chunk = file.read(Excon::CHUNK_SIZE)) && yield(chunk); end file.close new(data) else body = ::File.open(path,"rb") { |io| io.read } new(data.merge!(:body => body)) end else nil end end