Runtime
Bundler
Package Manager
Test Runner
Guides
Reference
Blog
Install Bun
Guides Utilities

Convert an absolute path to a file URL

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.

On this page

No Headings