FileSystemManager.unlinkSync

解释:删除文件的同步接口。 方法参数:String filePath **:要删除的文件路径。 Error对象

代码示例

-

  1. Page({ onLoad() { const fs = swan.getFileSystemManager(); this.fs = fs; }, unlinkSync() { try { let result = this.fs.unlinkSync( `${swan.env.USER_DATA_PATH}/demo.txt` ); console.log('unlinkSync success', result); } catch (err) { console.log('unlinkSync fail', err); } }});