tencent cloud

Feedback

Single-URL Speed Limits

Last updated: 2021-12-27 14:18:32

    Overview

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

    Use Instructions

    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);
    });
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support