Skip to main content

Sleep for a fixed number of milliseconds

还没翻译译自英文(bun.com)本页 4 段都还没译

Bun.sleep() returns a void Promise that resolves after a given number of milliseconds.

// sleep for 1 second
await Bun.sleep(1000);

Internally, Bun.sleep() is equivalent to the following setTimeout snippet.

await new Promise(resolve => setTimeout(resolve, ms));

See Utils.

Traducción © 2026 fanyi.dev · Original © 2026 the Bun project (LICENSE.md names no copyright holder) (MIT)