Delete Object
Updated at:2025-11-03
Delete Object
-
Basic workflow
- Create a BosClient instance.
- Call the deleteObject() method to execute the deletion.
-
Example code
JavaScript1// Delete Object 2 // Specify the name of the bucket where the object to be deleted is located and the name of the object 3client.deleteObject(<BucketName>, <ObjectKey>); -
Complete example
- Browser side:
let BosClient = baidubce.sdk.BosClient - Node.js:
import {BosClient} from '@baiducloud/sdk'
JavaScript1let config = { 2 endpoint: 'https://bj.bcebos.com' //Need to be modified according to the region where the bucket belongs 3 credentials: { 4 ak: <AccessKeyID>, //Your AK 5 sk: <SecretAccessKey> //Your SK 6 } 7}; 8let client = new BosClient(config); 9client.deleteObject(<BucketName>, <ObjectKey>); - Browser side:
