Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

std/node/url.ts>pathToFileURL

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function pathToFileURL
import { pathToFileURL } from "https://deno.land/std@0.145.0/node/url.ts";

This function ensures that filepath is resolved absolutely, and that the URL control characters are correctly encoded when converting into a File URL.

Parameters

filepath: string

The file path string to convert to a file URL.

Returns

The file URL object.