listAllObjectsV2 method

Future<ListObjectsResult> listAllObjectsV2(
  1. String bucket, {
  2. String prefix = '',
  3. bool recursive = false,
})

Returns all Objects in a bucket. This is a shortcut for listObjectsV2. Use listObjects to list buckets with a large number of objects. This uses ListObjectsV2 in the S3 API. For backward compatibility, use listAllObjects instead.

Implementation

Future<ListObjectsResult> listAllObjectsV2(
  String bucket, {
  String prefix = '',
  bool recursive = false,
}) async {
  final chunks = listObjects(bucket, prefix: prefix, recursive: recursive);
  final objects = <Object>[];
  final prefixes = <String>[];
  await for (final chunk in chunks) {
    objects.addAll(chunk.objects);
    prefixes.addAll(chunk.prefixes);
  }
  return ListObjectsResult(
    objects: objects,
    prefixes: prefixes,
  );
}