Returns a promise that resolves after a specified delay in milliseconds.
Useful for delaying execution in async workflows, testing, or simulating latency.
The number of milliseconds to sleep.
A promise that resolves after the specified delay.
console.log("Start");await sleep(1000); // wait 1 secondconsole.log("End"); Copy
console.log("Start");await sleep(1000); // wait 1 secondconsole.log("End");
1.1.0
Returns a promise that resolves after a specified delay in milliseconds.
Useful for delaying execution in async workflows, testing, or simulating latency.