import { notImplemented } from "../notImplemented.ts";
export async function exists( url: URL, fetchOpts?: RequestInit,): Promise<boolean> | never { switch (url.protocol) { case "file:": { try { const { isFile } = await Deno.stat(url);
return isFile; } catch { return false; } } case "http:": case "https:": { try { const res = await fetch(url.href, fetchOpts);
await res.arrayBuffer();
return res.ok; } catch { return false; } } default: { return notImplemented(`support for protocol '${url.protocol}'`); } }}