无法将图像移动到由express static使用的文件夹中。

huangapple go评论82阅读模式
英文:

Can't move image to folder, that is used by express static

问题

我有一个名为"static"的文件夹。这个文件夹被Express静态文件中间件使用。我创建了一个用Go语言编写的服务,用于将图片缩小,以便在前端正确显示。但是当文件被移动到"static"文件夹时,出现了"由于另一个进程正在使用该文件,因此无法访问该文件"的错误。

(在Linux上运行得很好,但在Windows上显示此错误)

如果需要任何代码,请告诉我。

英文:

I have "static" folder. This folder is used by express static. I created service (written in Go) which makes images smaller, so it can properly display on frontend. But when file is being moved to "static" folder it occures "The process cannot access the file because it is being used by another process" error.

(it worked great on linux, but on windows it shows me this error)

Let me know if any code is needed.

答案1

得分: 0

我通过不使用go脚本移动它,而是使用node(这是使用静态文件夹的进程)来解决了这个问题。

英文:

I solved this by not moving it with go script, using node (which is the process that uses static folder) instead.

huangapple
  • 本文由 发表于 2022年6月29日 18:34:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/72799926.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定