> ## 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.file` 获取当前文件的名称。

```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.file; // => "c.ts"
```

***

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