You can delete unwanted files directly from the console.
Console operations
-
Log on to the EMAS console , select Serverless , and then click Enter .
-
In the navigation pane on the left, select Cloud Storage .
-
Find the target file and click Delete .
-
In the dialog box that appears, click OK .
Client calls
The following code is an example:
const options = {
filePath: path,
headers: {
contentDisposition: 'attachment',
},
};
mpserverless.file.uploadFile(options).then((image) => {
mpserverless.file.deleteFile({ fileUrl: image.fileUrl });
});
Cloud Function Invocation
The following code is an example:
module.exports = async (ctx) => {
// ctx.args are the parameters passed from the client.
const res = await ctx.mpserverless.file.deleteFile({ fileUrl: ctx.args.fileUrl });
return res;
};
该文章对您有帮助吗?