Bun

指南实用程序

使用 Bun 获取当前文件名

Bun 在 import.meta 对象上提供了一些模块特定的实用程序。使用 import.meta.file 来检索当前文件的名称。

/a/b/c.ts
import.meta.file; // => "c.ts"

有关完整的文档,请参阅 文档 > API > import.meta