The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

AWS::S3::FileIterator - Easily access and iterate through your S3 files.

SYNOPSIS

# Iterate through all ".txt" files, 100 at a time:
my $iter = $bucket->files(
# Required params:
page_size => 100,
page_number => 1,
# Optional params:
pattern => qr(\.txt$),
prefix => 'notes',
);
while( my @files = $iter->next_page )
{
warn $iter->page_number, "\n";
foreach my $file ( @files )
{
print "\t", $file->key, "\n";
}# end foreach()
}# end while()

DESCRIPTION

AWS::S3::FileIterator provides a means of iterating through your S3 files.

If you only have a few files it might seem odd to require an iterator, but if you have thousands (or millions) of files, the iterator will save you a lot of effort.

PUBLIC PROPERTIES

has_prev

Boolean - read-only

has_next

Boolean - read-only

page_number

Integer - read-write

marker

String - read-only

Used internally to tell Amazon S3 where the last request for a listing of files left off.

pattern

Regexp - read-only

If supplied to the constructor, only files which match the pattern will be returned.

prefix

String - read-only

If supplied to the constructor, only files which begin with the indicated prefix will be returned.

PUBLIC METHODS

next_page()

Returns the next page of results as an array in list context or arrayref in scalar context.

Increments page_number by one.

SEE ALSO

The Amazon S3 API Documentation

AWS::S3

AWS::S3::Bucket

AWS::S3::File

AWS::S3::Owner

Iterator::Paged - on which this class is built.