I have the following problem: need synchronously wait until a file exists on a certain path.
More details on my case: Files are created by other process. I'm patching node's require
which is only sync. No way work it around with async way.
So I can just do:
while(!fs.existsSync(filePath)) {}
or some more sophisticated stuff with a timeout, etc
But I'm not sure if this is a most efficient way to do this: while waiting to perform synchronously fs.existsSync
.
Just wanted to hear any other suggestions?