> ## Documentation Index
> Fetch the complete documentation index at: https://bun.ll1025.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 休眠固定毫秒数

`Bun.sleep()` 返回一个 void `Promise`，在给定毫秒数后解析。

```ts theme={null}
// 休眠 1 秒
await Bun.sleep(1000);
```

***

在内部，它等同于以下 [`setTimeout`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout) 代码片段。

```ts theme={null}
await new Promise(resolve => setTimeout(resolve, ms));
```

***

参见 [工具](/runtime/utils)。
