Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback


Deno standard library
Go to Latest
function toFileUrl
import { toFileUrl } from "";

Converts a path string to a file URL.

import { toFileUrl } from "";

// posix
toFileUrl("/home/foo"); // new URL("file:///home/foo")

// win32
toFileUrl("\\home\\foo"); // new URL("file:///home/foo")
toFileUrl("C:\\Users\\foo"); // new URL("file:///C:/Users/foo")
toFileUrl("\\\\\\home\\foo"); // new URL("file://")


path: string

to convert to file URL