> ## 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 在 [`import.meta`](/runtime/module-resolution#import-meta) 对象上提供了一些模块特定的实用工具。使用 `import.meta.dir` 获取当前文件所在目录的绝对路径。

```ts /a/b/c.ts icon="https://mintcdn.com/span-inc/82N53aP7NFbaCVSl/icons/typescript.svg?fit=max&auto=format&n=82N53aP7NFbaCVSl&q=85&s=787d39d6a7d96d7f9540dc74344eba23" theme={null}
import.meta.dir; // => "/a/b"
```

***

参见 [`import.meta`](/runtime/module-resolution#import-meta)。
