tencent cloud

List Objects
Last updated:2026-02-02 16:54:12
List Objects
Last updated: 2026-02-02 16:54:12

Introduction

This document provides an overview of APIs related to list object operations and sample SDK code examples.
API
Operation Name
Operation Description
List Objects
List partial or all objects in this bucket.

List Objects

Feature Overview

List partial or all objects in this bucket (List Object).

Example Code

// Bucket name, which consists of bucketname-appid (appid must be included), can be viewed in the COS console. https://console.tencentcloud.com/cos5/bucket
let bucket = "examplebucket-1250000000";

let request = new ListObjectsRequest(bucket);
// Obtain all files in the dir directory: request.prefix = "dir/"
// Obtain all files in the root directory: request.prefix = "";
request.prefix = "dir/"
try {
let result = await CosXmlBaseService.default().listObject(request)
// result includes http headers, etc.
} catch (e) {
// Exception
// Processing
}

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback