Release Notes
Announcements
// Bucket name, which consists of bucketname-appid (appid must be included), can be viewed in the COS console. https://console.tencentcloud.com/cos5/bucketlet bucket = "examplebucket-1250000000";//The location identifier of an object in a bucket, also known as the object keylet cosPath = "exampleobject.txt";let request = new PresignedUrlRequest(bucket, cosPath, http.RequestMethod.PUT); try { let result = await CosXmlBaseService.default().buildPresignedUrl(request) // result is the signed upload URLif(result){// Upload data let httpRequest = http.createHttp(); try { let data = await httpRequest.request(result, { method: http.RequestMethod.PUT, extraData: 'data to put' }); httpRequest.destroy(); } catch (err) {httpRequest.destroy(); // Upload exception handling } } } catch (e) { // Exception handling }
// Bucket name, which consists of bucketname-appid (appid must be included), can be viewed in the COS console. https://console.tencentcloud.com/cos5/bucketlet bucket = "examplebucket-1250000000";//The location identifier of an object in a bucket, also known as the object keylet cosPath = "exampleobject.txt";let request = new PresignedUrlRequest(bucket, cosPath, http.RequestMethod.GET); try { let result = await CosXmlBaseService.default().buildPresignedUrl(request) // result is the signed download URLif(result){// Download data let httpRequest = http.createHttp(); try { let data = await httpRequest.request(result, { method: http.RequestMethod.GET }); httpRequest.destroy(); } catch (err) {httpRequest.destroy(); // Download exception handling } } } catch (e) { // Exception handling }
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback