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.
Sample 1: limiting single-URL speed on uploads
cos.putObject({
Bucket: 'examplebucket-1250000000',
Region: 'COS_REGION',
Key: '1.jpg',
StorageClass: 'STANDARD',
Body: fileObject,
Headers: {
'x-cos-traffic-limit': 819200,
},
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',
Region: 'COS_REGION',
Key: '1.jpg',
Headers: {
'x-cos-traffic-limit': 819200,
},
}, function(err, data) {
console.log(err || data.Body);
});
Was this page helpful?