tencent cloud

Cloud Object Storage

List Objects

PDF
Focus Mode
Font Size
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
}


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback