tencent cloud

Smart Media Hosting

Product Introduction
Product Overview
Feature Description
Product Strengths
Use Cases
Basic Concept
Purchase Guide
Quick Start
Create Media Library
Initiate request
Service Level API Document
History
Introduction
API Category
Making API Requests
PaaS Service APIs
Official Cloud Disk APIs
Data Types
Error Codes
Business Level API Document
Introduction
Access Token Operation API
Tenant Space Operation API
File Operation API
Directory or Album Operation API
Recycle Bin Operation API
Quota Operation API
Query Task Operation API
Search Operation API
Historical Version Operations API
Directory and File Batch Operation API
Collection Operation API
Error Codes
SDK Documentation
Android SDK
iOS SDK
HarmonyOS SDK
FAQs
Enterprise Network Disk
Product Introduction
Purchase Guide
Quick Start
FAQs
Service Level Agreement
Glossary

Download

PDF
Focus Mode
Font Size
Last updated: 2026-01-07 10:49:05

Introduction

This document provides an API overview and SDK example code for file download.

SDK API Reference

For specific parameters and method descriptions of all APIs in the SDK, refer to SDK API Reference.

Advanced Download

Feature Description

The download method automatically performs downloading to local, suspension, resuming upload, and cancellation logic internally.

Starting or Resuming the Download

QCloudCOSSMHDownloadObjectRequest *req = [QCloudCOSSMHDownloadObjectRequest new];

// full file path
req.filePath = @"filepath";
// Media Library ID, required parameter
req.libraryId = @"libraryId";
// Space ID. If the media library is in single-tenant mode, this parameter is fixed as a hyphen (-); if the media library is in multi-tenant mode, you must specify this parameter.
req.spaceId = @"spaceId";
// When this option is set to YES, it will compare the crc64 of the file stored in COS with the crc64 of the file downloaded to local after download completion
Currently enabled by default.
req.enableCRC64Verification = YES;
// Whether to use part and resume download, defaults to YES.
req.resumableDownload = YES;
// Local download path
req.downloadingURL = cto.tempFileURL;
// Progress callback
[req setDownProcessBlock:^(int64_t bytesDownload, int64_t totalBytesDownload, int64_t totalBytesExpectedToDownload) {

}];
// Complete callback
[req setFinishBlock:^(id outputObject, NSError *error) {

}];
[[QCloudSMHService defaultSMHService] smhDownload:req];

Pause

[request cancel];

Deleting or Canceling

[request remove];


Help and Support

Was this page helpful?

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

Feedback