tencent cloud

Single-URL Speed Limits
Last updated: 2024-02-02 17:35:18
Single-URL Speed Limits
Last updated: 2024-02-02 17:35:18

Overview

This document describes how to limit the speed on a single URL when calling the upload or download API.

Directions

The speed range is 819200 to 838860800 (in bit/s), that is, 100 KB/s to 100 MB/s. If a value is not within this range, 400 will be returned.
Note:
For more information about the speed limits on object downloads, please see Single-URL Speed Limits.

Sample 1: limiting single-URL speed on uploads

cos.putObject({
Bucket: 'examplebucket-1250000000', /* Your bucket name. Required. */
Region: 'COS_REGION', /* Bucket region, such as `ap-beijing`. Required. */
Key: '1.jpg', /* Object key stored in the bucket (such as `1.jpg` and `a/b/test.txt`). Required. */
StorageClass: 'STANDARD',
Body: fileObject, // Upload the file object.
Headers: {
'x-cos-traffic-limit': 819200, // The speed range is 819200 to 838860800, that is 100 KB/s to 100 MB/s. If the value is not within this range, 400 will be returned.
},
onProgress: function(progressData) {
console.log(JSON.stringify(progressData));
}
}, function(err, data) {
console.log(err || data);
});

Sample 2: limiting single-URL speed on downloads

cos.getObject({
Bucket: 'examplebucket-1250000000', /* Your bucket name. Required. */
Region: 'COS_REGION', /* Bucket region, such as `ap-beijing`. Required. */
Key: '1.jpg', /* Object key stored in the bucket (such as `1.jpg` and `a/b/test.txt`). Required. */
Headers: {
'x-cos-traffic-limit': 819200, // The speed range is 819200 to 838860800, that is 100 KB/s to 100 MB/s. If the value is not within this range, 400 will be returned.
},
}, function(err, data) {
console.log(err || data.Body);
});

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

Feedback