--- title: "List Objects in a Bucket" url: https://docs.catalyst.zoho.com/en/sdk/javascript/v1/cloudscale/stratus/list-objects/ description: "This page describes the method to execute circuits in your application with sample code snippets." last_updated: 2026-09-09T10:45:38Z service: CloudScale type: general related_links: - name: "Catalyst CloudScale" url: /en/cloud-scale/ - name: "Stratus Help Documentation" url: /en/cloud-scale/help/stratus/introduction/ - name: "Java SDK Documentation" url: /en/sdk/java/v1/cloud-scale/stratus/list-objects/ - name: "Python SDK Documentation" url: /en/sdk/python/v1/cloud-scale/stratus/list-objects/ - name: "iOS SDK Documentation" url: /en/sdk/ios/v2/cloud-scale/stratus/get-object/ - name: "Android SDK Documentation" url: /en/sdk/android/v2/cloud-scale/stratus/get-object/ - name: "Flutter SDK Documentation" url: /en/sdk/flutter/v2/cloud-scale/stratus/get-object/ - name: "REST API Documentation" url: /en/api/code-reference/cloud-scale/stratus/get-object/#GetaSpecificObject repository: name: "Repository" url: https://github.com/catalystbyzoho/zcatalyst-sdk-js --- # List Objects in a Bucket > **Note:** Ensure you have installed the [required package](https://docs.catalyst.zoho.com/en/sdk/javascript/v1/cloudscale/stratus/overview/#prerequisites) to use this SDK method. ### List All Objects by Pagination This SDK method will allow you to get a list of all the objects present in a particular bucket by pagination. The `bucket` reference used in the following code snippet is the [component instance](https://docs.catalyst.zoho.com/en/sdk/javascript/v1/cloudscale/stratus/create-bucket-instance/). For each call, a limited number of objects will be returned, and the next call will be initiated only if a continuation token is returned. #### Parameters Used
Parameter Name Data Type Definition
`maxKey` **String** A **Mandatory** parameter. Will contain the maximum limit of objects.
`nextToken` **String** A **mandatory** parameter. Will contain the token to get the next set of objects.
`prefix` **String** An **optional** parameter. To list objects that match the prefix value.
`orderBy` **String** An **optional** parameter. To list objects either in ascending or descending order. **Default Value**: `asc`
`folderListing` **String** An **optional** parameter. To choose to list either just the root-level objects in the bucket or list all the objects present in all the paths of the bucket. **Default Value**: `false` For example, If you set the value as `true`, the root-level objects alone will be listed. If you set the value as `false`, all the objects present in all the paths of the bucket will be listed.
In the following SDK method, a maximum value of pagination is set using `maxKey`. Using prefix, you can list objects that only match the `prefix`. The response you get will contain the following properties of the bucket, which will be stored in `moreOptions`: * `key count`: Will contain the value of the number of objects that are being returned. * `max keys`: The maximum limit of objects that can be returned. * `Truncated`: Will contain the status to notify if a bucket is truncated or not. * `contents`: List of object details. * `continuation_token`: If you a sent a `continuation_token` in the request, it will be shown in the response. * `next_continuation_token`: If the response was truncated, the value of this key must be passed as `continuation_token` to the same method for retrieving the next set of objects. With each iteration, you need to list the `maxkeys` number of objects and check if `nextToken` has been created. Using `nextToken` you can continue the iteration until all the objects have been listed. ```javascript async function listMyPaginatedObjects(maxKeys = null, prefix = null, nextToken = null) { const options = { // Maximum number of keys to return in one call maxKeys, // Token to fetch the next page of objects continuationToken: nextToken, // Order in which objects are listed: 'asc' or 'desc' // orderBy: 'desc', // Whether to list objects in a folder-like structure (true) or flat structure (false) // folderListing: 'true', // Only list objects with this prefix prefix }; // Retrieve a page of objects const objects = await bucket.listPagedObjects(options); console.log("response:", objects.contents); // If more objects are available, recursively fetch the next set if (objects.truncated) { listMyPaginatedObjects(maxKeys, prefix, objects.next_continuation_token); } } // Initial call to list objects with a maximum of 2 keys per page and prefix "sam" await listMyPaginatedObjects(4, "Img"); ``` #### Example of Expected Response ```javascript response: [ StratusObject { keyDetails: { key_type: 'file', key: 'random_gen_design/img_1.jpeg', size: 8713, content_type: 'image/jpeg', etag: '56fcb562a4bc4fb981b0c40a7feb2408', last_modified: 'Sep 10, 2025 01:15 PM', object_url: 'https://zylker14266-development.zohostratus.com/random_gen_design/img_1.jpeg' } }, StratusObject { keyDetails: { key_type: 'file', key: 'aquatic_sea_ven/Img_3.jpg', size: 31467, content_type: 'image/jpeg', etag: 'd25b2e9d70ef34d2b4a1397a6f4703e4', last_modified: 'Sep 10, 2025 01:16 PM', object_url: 'https://zylker14266-development.zohostratus.com/aquatic_sea_ven/Img_3.jpg' } }, StratusObject { keyDetails: { key_type: 'file', key: 'random_gen_design/Img_5.png', size: 3818, content_type: 'image/png', etag: 'ab1918da8f9c47aa51b0f1d4949c6021', last_modified: 'Sep 10, 2025 01:17 PM', object_url: 'https://zylker14266-development.zohostratus.com/random_gen_design/Img_5.png' } }, StratusObject { keyDetails: { key_type: 'file', key: 'random_gen_design/Img_7.png', size: 19037, content_type: 'image/png', etag: '349a98b743fbe6e89ddf09ab31673fa6', last_modified: 'Sep 10, 2025 01:17 PM', object_url: 'https://zylker14266-development.zohostratus.com/random_gen_design/Img_7.png' } }, StratusObject { keyDetails: { key_type: 'file', key: 'random_gen_design/Img_8.png', size: 3275, content_type: 'image/png', etag: '4a671a721c643f8506d112b7f6b39436', last_modified: 'Sep 10, 2025 01:17 PM', object_url: 'https://zylker14266-development.zohostratus.com/random_gen_design/Img_8.png' } }, StratusObject { keyDetails: { key_type: 'file', key: 'aquatic_sea_ven/Img_2.jpg', version_id: '01k4s9hgptxam14jrrn303negs', size: 15103, content_type: 'image/jpeg', etag: '7ff12ee34cc16ceb3f8b0f72301bd154', last_modified: 'Sep 10, 2025 01:18 PM', object_url: 'https://zylker14266-development.zohostratus.com/aquatic_sea_ven/Img_2.jpg' } }, StratusObject { keyDetails: { key_type: 'file', key: 'aquatic_sea_ven/Img_3.jpg', version_id: '01k4s9hh8s2v66gvxr4e83x3k8', size: 31467, content_type: 'image/jpeg', etag: 'd25b2e9d70ef34d2b4a1397a6f4703e4', last_modified: 'Sep 10, 2025 01:18 PM', object_url: 'https://zylker14266-development.zohostratus.com/aquatic_sea_ven/Img_3.jpg' } }, StratusObject { keyDetails: { key_type: 'file', key: 'aquatic_sea_ven/Img_9.jpg', version_id: '01k4s9hj1av91pd7khzr9zrh89', size: 23413, content_type: 'image/jpeg', etag: 'f466f787332836d8aca3b73d482bca05', last_modified: 'Sep 10, 2025 01:18 PM', object_url: 'https://zylker14266-development.zohostratus.com/aquatic_sea_ven/Img_9.jpg' } }, StratusObject { keyDetails: { key_type: 'file', key: 'aquatic_sea_ven/Img_10.jpg', version_id: '01k4s9hjjp1gd9m65atdg6qgtq', size: 13806, content_type: 'image/jpeg', etag: 'de18f77d95a15977600e348d621caccd', last_modified: 'Sep 10, 2025 01:18 PM', object_url: 'https://zylker14266-development.zohostratus.com/aquatic_sea_ven/Img_10.jpg' } }, StratusObject { keyDetails: { key_type: 'file', key: 'road_vendor/Img_4.jpg', version_id: '01k4s9m3gn1r2b34x398kkfmhh', size: 11452, content_type: 'image/jpeg', etag: '00feebcfcd51053ff3208a051b0d39e6', last_modified: 'Sep 10, 2025 01:19 PM', object_url: 'https://zylker14266-development.zohostratus.com/road_vendor/Img_4.jpg' } }, StratusObject { keyDetails: { key_type: 'file', key: 'road_vendor/Img_6.avif', version_id: '01k4s9mbdf4t2nb6bqx7rqww5v', size: 5274, content_type: 'image/avif', etag: 'e00859eba271306185a894fa6bccb104', last_modified: 'Sep 10, 2025 01:19 PM', object_url: 'https://zylker14266-development.zohostratus.com/road_vendor/Img_6.avif' } } ] ``` ### List Objects Through Iteration Using this SDK method, you can list all the objects present in a bucket in a single API call using the iteration technique. Using the `maxKey` variable, you can access the required number of objects. ```javascript const options = { // Maximum number of objects returned per request maxKeys: 5, // Order in which objects are listed: 'asc' or 'desc' // orderBy: 'desc', // Whether to list objects in a folder-like structure (true) or flat structure (false) // folderListing: 'true', // Only list objects that begin with the specified prefix prefix: 'Img' }; // List iterable files from the bucket const files = bucket.listIterableObjects(options); ``` #### Example of Expected Response ```javascript response: [ StratusObject { keyDetails: { key_type: 'file', key: 'random_gen_design/img_1.jpeg', size: 8713, content_type: 'image/jpeg', etag: '56fcb562a4bc4fb981b0c40a7feb2408', last_modified: 'Sep 10, 2025 01:15 PM', object_url: 'https://tbd14266-development.zohostratus.com/random_gen_design/img_1.jpeg' } }, StratusObject { keyDetails: { key_type: 'file', key: 'aquatic_sea_ven/Img_3.jpg', size: 31467, content_type: 'image/jpeg', etag: 'd25b2e9d70ef34d2b4a1397a6f4703e4', last_modified: 'Sep 10, 2025 01:16 PM', object_url: 'https://tbd14266-development.zohostratus.com/aquatic_sea_ven/Img_3.jpg' } }, StratusObject { keyDetails: { key_type: 'file', key: 'random_gen_design/Img_5.png', size: 3818, content_type: 'image/png', etag: 'ab1918da8f9c47aa51b0f1d4949c6021', last_modified: 'Sep 10, 2025 01:17 PM', object_url: 'https://tbd14266-development.zohostratus.com/random_gen_design/Img_5.png' } }, StratusObject { keyDetails: { key_type: 'file', key: 'random_gen_design/Img_7.png', size: 19037, content_type: 'image/png', etag: '349a98b743fbe6e89ddf09ab31673fa6', last_modified: 'Sep 10, 2025 01:17 PM', object_url: 'https://tbd14266-development.zohostratus.com/random_gen_design/Img_7.png' } }, StratusObject { keyDetails: { key_type: 'file', key: 'random_gen_design/Img_8.png', size: 3275, content_type: 'image/png', etag: '4a671a721c643f8506d112b7f6b39436', last_modified: 'Sep 10, 2025 01:17 PM', object_url: 'https://tbd14266-development.zohostratus.com/random_gen_design/Img_8.png' } }, StratusObject { keyDetails: { key_type: 'file', key: 'aquatic_sea_ven/Img_2.jpg', version_id: '01k4s9hgptxam14jrrn303negs', size: 15103, content_type: 'image/jpeg', etag: '7ff12ee34cc16ceb3f8b0f72301bd154', last_modified: 'Sep 10, 2025 01:18 PM', object_url: 'https://tbd14266-development.zohostratus.com/aquatic_sea_ven/Img_2.jpg' } }, StratusObject { keyDetails: { key_type: 'file', key: 'aquatic_sea_ven/Img_3.jpg', version_id: '01k4s9hh8s2v66gvxr4e83x3k8', size: 31467, content_type: 'image/jpeg', etag: 'd25b2e9d70ef34d2b4a1397a6f4703e4', last_modified: 'Sep 10, 2025 01:18 PM', object_url: 'https://tbd14266-development.zohostratus.com/aquatic_sea_ven/Img_3.jpg' } }, StratusObject { keyDetails: { key_type: 'file', key: 'aquatic_sea_ven/Img_9.jpg', version_id: '01k4s9hj1av91pd7khzr9zrh89', size: 23413, content_type: 'image/jpeg', etag: 'f466f787332836d8aca3b73d482bca05', last_modified: 'Sep 10, 2025 01:18 PM', object_url: 'https://tbd14266-development.zohostratus.com/aquatic_sea_ven/Img_9.jpg' } }, StratusObject { keyDetails: { key_type: 'file', key: 'aquatic_sea_ven/Img_10.jpg', version_id: '01k4s9hjjp1gd9m65atdg6qgtq', size: 13806, content_type: 'image/jpeg', etag: 'de18f77d95a15977600e348d621caccd', last_modified: 'Sep 10, 2025 01:18 PM', object_url: 'https://tbd14266-development.zohostratus.com/aquatic_sea_ven/Img_10.jpg' } }, StratusObject { keyDetails: { key_type: 'file', key: 'road_vendor/Img_4.jpg', version_id: '01k4s9m3gn1r2b34x398kkfmhh', size: 11452, content_type: 'image/jpeg', etag: '00feebcfcd51053ff3208a051b0d39e6', last_modified: 'Sep 10, 2025 01:19 PM', object_url: 'https://tbd14266-development.zohostratus.com/road_vendor/Img_4.jpg' } }, StratusObject { keyDetails: { key_type: 'file', key: 'road_vendor/Img_6.avif', version_id: '01k4s9mbdf4t2nb6bqx7rqww5v', size: 5274, content_type: 'image/avif', etag: 'e00859eba271306185a894fa6bccb104', last_modified: 'Sep 10, 2025 01:19 PM', object_url: 'https://tbd14266-development.zohostratus.com/road_vendor/Img_6.avif' } } ] ```