Bun

GuidesUtilities

Convert an absolute path to a file URL with Bun

Use Bun.pathToFileURL() to convert an absolute path to a file:// URL.

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

See Docs > API > Utils for more useful utilities.