Class: S3Cat::FileReader

Inherits:
Object
  • Object
show all
Defined in:
lib/s3_cat/file_reader.rb

Instance Method Summary collapse

Constructor Details

#initialize(s3_client: S3Cat.s3_client) ⇒ FileReader

Returns a new instance of FileReader.



5
6
7
# File 'lib/s3_cat/file_reader.rb', line 5

def initialize(s3_client: S3Cat.s3_client)
  @s3_client = s3_client
end

Instance Method Details

#read_files(bucket, files, output_stream) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/s3_cat/file_reader.rb', line 9

def read_files(bucket, files, output_stream)
  files.each do |file|
    s3_client.get_object(bucket: bucket, key: file) do |chunk|
      output_stream.write(chunk)
    end
  end
end