Bun

指南工具程式

用 Bun 取得目前檔案檔名

Bun 在 import.meta 物件上提供了一些特定於模組的工具程式。使用 import.meta.file 來擷取目前檔案的名稱。

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

請參閱 文件 > API > import.meta 以取得完整文件。