toFileUrl
import { toFileUrl } from "jsr:@ende/path";function
function toFileUrl(path: string): URLConverts a path string to a file URL.
path: stringPath to convert to file URL.
Returns
The file URL equivalent to the path.
Example: Usage
import { toFileUrl } from "@ende/path/to-file-url";
import { assertEquals } from "@ende/assert";
if (Ende.build.os === "windows") {
assertEquals(toFileUrl("\\home\\foo"), new URL("file:///home/foo"));
assertEquals(toFileUrl("C:\\Users\\foo"), new URL("file:///C:/Users/foo"));
assertEquals(toFileUrl("\\\\127.0.0.1\\home\\foo"), new URL("file://127.0.0.1/home/foo"));
} else {
assertEquals(toFileUrl("/home/foo"), new URL("file:///home/foo"));
}