On Windows, files are often accessed by the built-in antivirus or other sub-systems shortly after their creation. During these accesses, the file cannot be moved to a new location. It's (apparently) customary to include some retry logic on the Windows platform when doing moves / atomic writes to account for this.
I think the solution is to use something like graceful-fs which I believe can handle this internally but Claude also suggested some boilerplate that was painfully verbose but seems roughly correct.
On Windows, files are often accessed by the built-in antivirus or other sub-systems shortly after their creation. During these accesses, the file cannot be moved to a new location. It's (apparently) customary to include some retry logic on the Windows platform when doing moves / atomic writes to account for this.
I think the solution is to use something like
graceful-fswhich I believe can handle this internally but Claude also suggested some boilerplate that was painfully verbose but seems roughly correct.