Bun

指南實用程式

使用 Bun 將絕對路徑轉換為檔案 URL

使用 Bun.pathToFileURL() 將絕對路徑轉換為 file:// URL。

Bun.pathToFileURL("/path/to/file.txt");
// => "file:///path/to/file.txt"

有關更多有用的工具,請參閱 文件 > API > 工具