class S3Cat::FileLister
Attributes
s3_client[R]
Public Class Methods
new(s3_client: S3Cat.s3_client)
click to toggle source
# File lib/s3_cat/file_lister.rb, line 5 def initialize(s3_client: S3Cat.s3_client) @s3_client = s3_client end
Public Instance Methods
list_files(bucket, prefix)
click to toggle source
# File lib/s3_cat/file_lister.rb, line 9 def list_files(bucket, prefix) Enumerator.new do |y| continuation_token = nil loop do response = s3_client.list_objects_v2(bucket: bucket, prefix: prefix, continuation_token: continuation_token) response.contents.map(&:key).each { |key| y << key } break unless response.is_truncated continuation_token = response.continuation_token end end end