How to do fs.existsSync(path) with Timeout
问题 I'm writing an automated test script using TestCafe and Node.JS. One of the tests is to download a file and validate that the download is complete. I don't want to write a hard coded await t.wait(4000); because since my test is based on a data driven framework I can feed it lots of data with lots of different files and file types. So the file size could vary by extreme amounts from a few Kilobytes to Gigabytes. So writing await t.wait(4000); might work for one test case but will almost