Constimport {
setTimeout,
} from 'node:timers/promises';
const res = await setTimeout(100, 'result');
console.log(res); // Prints 'result'
Optionaldelay: number
The number of milliseconds to wait before fulfilling the
promise. Default: 1.
Optionalvalue: T
A value with which the promise is fulfilled.
Optionaloptions: TimerOptions
Sleep asynchronously.