Method: S3#get

Defined in:
lib/cryo/store/s3.rb

#get(opts = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/cryo/store/s3.rb', line 15

def get(opts={})
  bucket = opts[:bucket]
  key = opts[:key]
  file_path = opts[:file] || opts[:path]
  if file_path
    File.open(file_path,'w') do |file|
      @s3.buckets[bucket].objects[key].read {|chunk| file.write chunk}
      return true
    end
  else
    return @s3.buckets[bucket].objects[key].read
  end
end