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

x/ayonli_jsext/path/util.ts>isFileUrl

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

Checks if the given string is a file URL, whether with or without //.

Examples

Example 1

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

console.assert(isFileUrl("file:///C:/Windows/System32"));
console.assert(isFileUrl("file://localhost/C:/Windows/System32"));
console.assert(isFileUrl("file:///usr/bin"));
console.assert(isFileUrl("file:/usr/bin"));
console.assert(isFileUrl("file:///usr/bin?foo=bar"));

Parameters

str: string

Returns

boolean