fileURLToPath

Bun

Symbol

fileURLToPath

function fileURLToPath(url: string | URL): string

Convert a URL to a filesystem path.

@param url

The URL to convert.

@returns

A filesystem path.

const path = Bun.fileURLToPath(new URL("file:///foo/bar.txt"));
console.log(path); // "/foo/bar.txt"

Referenced types

class URL

The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference