diff --git a/pages/API/get-file-system-manager/get-file-system-manager.uvue b/pages/API/get-file-system-manager/get-file-system-manager.uvue index d4d7833509dabca277198cebb13f1b2aae24bd3e..029c033640551e712319edd32689a1d77edc4438 100644 --- a/pages/API/get-file-system-manager/get-file-system-manager.uvue +++ b/pages/API/get-file-system-manager/get-file-system-manager.uvue @@ -1,17 +1,19 @@ @@ -337,6 +339,49 @@ } } as UnLinkOptions) }, + unlinkAllFileTest:function(e:any){ + let fileManager = uni.getFileSystemManager() + fileManager.readdir({ + dirPath:`${this.basePath}${this.rmDirFile}`, + success:function(res:ReadDirSuccessResult){ + console.log("success to readdir",res) + res.files.forEach(element => { + console.log(element) + fileManager.unlink({ + filePath:`${this.basePath}${this.rmDirFile}/${element}`, + success:function(res:FileManagerSuccessResult){ + console.log('success unlink',res) + }, + fail:function(res:UniError){ + console.log('fail unlink',res) + this.lastFailError = res + }, + complete:function(res:any){ + if(res instanceof UniError){ + this.lastCompleteError = res + } + console.log("complete unlink",res) + this.done = true + } + } as UnLinkOptions) + }); + }, + fail:function(res:any){ + console.log('fail to readdir',res) + this.lastFailError = res + }, + complete:function(res:any){ + console.log("complete readdir",res) + this.done = true + if(res instanceof ReadDirSuccessResult){ + this.fileListComplete = res.files + } + if(res instanceof UniError){ + this.lastCompleteError = res + } + } + } as ReadDirOptions) + }, } }