tencent cloud

Cloud Object Storage

Per-Connection Rate Limiting

PDF
Modo Foco
Tamanho da Fonte
Última atualização: 2026-02-02 17:37:24

Introduction

This document provides information on rate limiting for links when upload and download interfaces are called.

Usage Instructions

The rate limit setting range is 819200 - 838860800, the unit defaults to bit/s, that is, 800Kb/s - 800Mb/s. If it exceeds this range, a 400 error will be returned.
Note
For more information on single link rate limiting, see the single link rate limiting Developer Guide.

Sample Code 1: Single Link Rate Limiting During Upload

// 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";
//The location identifier of an object in a bucket, also known as the object key
let cosPath = "exampleobject.txt";
//Local file path
let srcPath = "Local file path";

let putRequest = new PutObjectRequest(bucket, cosPath, srcPath);
// Set the single link rate limit in bit/s, for example, 1M/s putRequest.addHeader("x-cos-traffic-limit", (1024 * 1024 * 8).toString()); let task: UploadTask = CosXmlBaseService.default().upload(putRequest);
// Start upload task.start();

Sample Code 2: Rate Limiting for a Single Link During Download

// 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";
//The location identifier of an object in a bucket, also known as the object key
let cosPath = "exampleobject.txt";
// Local file download path. If the file does not exist, the sdk will automatically create it.
let downliadPath = "Local file path";

let getRequest = new GetObjectRequest(bucket, cosPath, downliadPath);
// Set the single link rate limit in bit/s, for example, 1M/s getRequest.addHeader("x-cos-traffic-limit", (1024 * 1024 * 8).toString()); let task: DownloadTask = CosXmlBaseService.default().download(getRequest);
// Start download task.start();


Ajuda e Suporte

Esta página foi útil?

comentários