rembrembdocs

Skip to main content

Bun home pagelight logodark logo

[Runtime

](../../../index.md)[Package Manager

](../../../pm/cli/install/index.md)[Bundler

](../../../bundler/index.md)[Test Runner

](../../../test/index.md)[Guides

](../../index.md)[Reference

](https://bun.com/reference)[Blog

](https://bun.com/blog)[Feedback

](../../../feedback/index.md)

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.

Was this page helpful?

Suggest editsRaise issue

[

Convert a file URL to an absolute path

Previous

](../file-url-to-path/index.md)[

Get the path to an executable bin file

Next

](../which-path-to-executable-bin/index.md)