fromFileUrl

import { fromFileUrl } from "jsr:@ende/path/windows/from-file-url";

function

function fromFileUrl(url: URL | string): string

Converts a file URL to a path string.

url: URL | string

The file URL to convert.

Returns

The path string.

Example: Usage

import { fromFileUrl } from "@ende/path/windows/from-file-url";
import { assertEquals } from "@ende/assert";

assertEquals(fromFileUrl("file:///home/foo"), "\\home\\foo");
assertEquals(fromFileUrl("file:///C:/Users/foo"), "C:\\Users\\foo");
assertEquals(fromFileUrl("file://localhost/home/foo"), "\\home\\foo");

Source