toFileUrl
import { toFileUrl } from "jsr:@ende/path/posix/to-file-url";function
function toFileUrl(path: string): URLConverts a path string to a file URL.
path: stringThe path to convert.
Returns
The file URL.
Example: Usage
import { toFileUrl } from "@ende/path/posix/to-file-url";
import { assertEquals } from "@ende/assert";
assertEquals(toFileUrl("/home/foo"), new URL("file:///home/foo"));
assertEquals(toFileUrl("/home/foo bar"), new URL("file:///home/foo%20bar"));
assertEquals(toFileUrl("//foo/bar"), new URL("file:///foo/bar"));