📌 从基础库 3.125.4 版本开始支持
参数名 | 类型 | 说明 |
---|---|---|
filePath | string | 要删除的文件路径(本地路径) |
const fs = xhs.getFileSystemManager() fs.unlink({ filePath: `${xhs.env.USER_DATA_PATH}/hello.txt`, success(res) { console.log(res) }, fail(res) { console.error(res) } }) // 同步接口 try { const res = fs.unlinkSync(`${xhs.env.USER_DATA_PATH}/hello.txt`) console.log(res) } catch(e) { console.error(e) }