Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/path/index.ts>toFileUrl

A JavaScript extension package for building strong and modern applications.
Latest
function toFileUrl
import { toFileUrl } from "https://deno.land/x/ayonli_jsext@v0.9.72/path/index.ts";

Converts the given path to a file URL if it's not one already.

Examples

Example 1

import { toFileUrl } from "@ayonli/jsext/path";

console.log(toFileUrl("foo/bar")); // "file:///foo/bar"
console.log(toFileUrl("c:\\foo\\bar")); // "file:///c:/foo/bar"

Parameters

path: string

Returns

string