The new stable timers API in Node 16, combined with top-level await, means that you can now easily sleep in an ESM Node script, like this:<p><pre><code> import { setTimeout } from 'timers/promises';
await setTimeout(1000);
console.log("awake");
</code></pre>
(But note that you'll have to activate ESM mode to write this script, e.g. by writing it in a `.mjs` file instead of a `.js` file or by adding a setting to package.json.) <a href="https://redfin.engineering/node-modules-at-war-why-commonjs-and-es-modules-cant-get-along-9617135eeca1" rel="nofollow">https://redfin.engineering/node-modules-at-war-why-commonjs-...</a>