Home / Function/ pathToFileURL() — astro Function Reference

pathToFileURL() — astro Function Reference

Architecture documentation for the pathToFileURL() function in utils.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  0890e718_9883_b038_815b_9a65c3fb181a["pathToFileURL()"]
  99e40dcb_3c3c_9f4c_eb6e_551c6ac52da6["utils.ts"]
  0890e718_9883_b038_815b_9a65c3fb181a -->|defined in| 99e40dcb_3c3c_9f4c_eb6e_551c6ac52da6
  d90421e9_e990_a7bb_5775_9589dc533165["slash()"]
  0890e718_9883_b038_815b_9a65c3fb181a -->|calls| d90421e9_e990_a7bb_5775_9589dc533165
  style 0890e718_9883_b038_815b_9a65c3fb181a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/db/src/runtime/utils.ts lines 29–41

export function pathToFileURL(path: string): URL {
	if (isWindows) {
		let slashed = slash(path);
		// Windows like C:/foo/bar
		if (!slashed.startsWith('/')) {
			slashed = '/' + slashed;
		}
		return new URL('file://' + slashed);
	}

	// Unix is easy
	return new URL('file://' + path);
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does pathToFileURL() do?
pathToFileURL() is a function in the astro codebase, defined in packages/db/src/runtime/utils.ts.
Where is pathToFileURL() defined?
pathToFileURL() is defined in packages/db/src/runtime/utils.ts at line 29.
What does pathToFileURL() call?
pathToFileURL() calls 1 function(s): slash.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free