tencent cloud

Deleting Files

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2025-12-31 11:48:16
By default, only users who have passed the login authentication can upload files to the cloud storage space. Therefore, login authentication should be performed first when files are uploaded on the user side (such as Web).
Note:
Up to 50 files can be deleted with one call; batch processing is required if the number exceeds 50.
By default, only the uploader, creator, or administrator of the file has the right to delete the corresponding file. User A is not allowed to delete User B's files.
You can also use custom security rules to set looser or stricter read/write permissions for cloud storage.
Using the SDK to call the deleteFile to delete one or multiple specified files in the cloud storage space.
Web
WeChat Mini Program
Node.js
//Step 1: Introduce the Web SDK.
import tcb from "@cloudbase/js-sdk";

//Step 2: Perform initialization.
const app = tcb.init({
env: "your-env-id"
});

//Step 3: Authenticate login. The following code is not complete. You need to select a login method. For details, see Quick Start > Login and User Cases.
const auth = app.auth({
persistence: "local" //The login authentication remains valid for 30 days until the user logs out or changes the password.
});

app
.deleteFile({
fileList: ["cloud://a/b/c", "cloud://d/e/f"]
})
.then((res) => {
console.log(res.fileList);
});

//First, use wx.cloud.init for initialization. There is no need to import the SDK again on the mini program side, and authentication is not required.
wx.cloud
.deleteFile({
fileList: ["cloud://a/b/c", "cloud://d/e/f"]
})
.then((res) => {
console.log(res.fileList);
});

const tcb = require("@cloudbase/node-sdk");
const app = tcb.init();

app
.deleteFile({
fileList: ["cloud://a/b/c", "cloud://d/e/f"]
})
.then((res) => {
console.log(res.fileList);
});



Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan