Open anyfig opened 3 months ago
c.FileAttachment(baseDir+req.FileName, req.FileName) DeleteFile(baseDir+req.FileName)
c.FileAttachment(baseDir+req.FileName, req.FileName) DeleteFile(baseDir+req.FileName)
不行啊
c.FileAttachment()后跟DeleteFile()或defer DeleteFile()都一样
看了一下代码,因为文件正在传输,hertz在读取文件,所以立刻删除失败了,需要等请求结束才能删除成功。
看了一下代码,因为文件正在传输,hertz在读取文件,所以立刻删除失败了,需要等请求结束才能删除成功。
c.FileAttachment()函数的文件传输好像是在另一个goroutine中,什么时候完成下载还没办法判断。o(╥﹏╥)o,有没有其他办法
看了一下代码,因为文件正在传输,hertz在读取文件,所以立刻删除失败了,需要等请求结束才能删除成功。
c.FileAttachment()函数的文件传输好像是在另一个goroutine中,什么时候完成下载还没办法判断。o(╥﹏╥)o,有没有其他办法
一起研究下看看,可以飞书群联系下我
Describe the Question hello, friends, delete a file after download it is a very common requirement in business, i want to impl it in hertz, and meet this problem, err: The process cannot access the file because it is being used by another process. Reproducible Code in java, its ok to delete file after download it.
in hertz, I tried two ways, neither work. (err: The process cannot access the file because it is being used by another process)
Additional context in FileDownload1, when time.Sleep(enough_time), file would be deleted successfully, but the time is uncontrollable.