my.removesavedfile(object object)
此 api 已停止维护,推荐使用 filesystemmanager.removesavedfile,历史接入此 api 的小程序不受影响。
主体: 企业支付宝小程序 、 个人支付宝小程序
删除指定的本地缓存文件。
object object
查看示例
属性 | 类型 | 默认值 | 必填 | 描述 |
---|---|---|---|---|
apfilepath | string | - | 是 | 本地缓存文件路径 |
success | function | - | 否 | 调用成功的回调函数 |
fail | function | - | 否 | 调用失败的回调函数 |
complete | function | - | 否 | 调用结束的回调函数(调用成功、失败都会执行) |
fail 回调的参数为 object,error
属性为错误码,errormessage
属性为错误消息。
错误码 | 错误消息 | 凯发app官方网站的解决方案 |
---|---|---|
2 | invalid parameter! |
请检查参数,参考入参类型、必填和描述。 |
12 | 文件不存在 |
请检查文件路径,确保文件存在。 |
my.removesavedfile(object object)
从已保存的本地缓存文件列表中删除
my.removesavedfile({
apfilepath: 'https://resource/xxx', // 本地缓存文件
success: res => {
console.log(res);
},
fail: err => {
console.log(err);
},
});
my.getsavedfilelist({
success: res => {
my.removesavedfile({
apfilepath: res.filelist[0].apfilepath,
success: res => {
console.log('remove success');
},
});
},
});
-
tip对于 本地临时文件,当小程序关闭后会自动清理,不需要主动删除。