// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// Copyright the Browserify authors. MIT License.

import { fromFileUrl } from "jsr:/@std/path@^0.224.0/from-file-url";

/**
 * Convert a URL or string to a path
 * @param pathUrl A URL or string to be converted
 */
export function toPathString(
  pathUrl: string | URL,
): string {
  return pathUrl instanceof URL ? fromFileUrl(pathUrl) : pathUrl;
}

// denoCacheMetadata={"headers":{"vary":"Origin","set-cookie":"__cf_bm=bnI7LBrRIj2GrxCR6zxnPUcZaiLZw5Nr12SHv.PaP6U-1785241875.2082803-1.0.1.1-bKgRSCT7TBD_OU3aTuuAbQjo1.RIxqcWFxXZo99.4N.sQw.5R6DPYiFsS.FoeIBIOguhvDTfw_ZxeEMy9tphpaGM5IPtI5FdMb27_StgfE7JEIq6jsoGCNFIPxEg1irN; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","content-type":"text/typescript","content-length":"426","etag":"\"84ea00f4f30fae79c59644b18e400445\"","x-content-type-options":"nosniff","age":"44351","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';","date":"Tue, 28 Jul 2026 12:31:15 GMT","access-control-allow-origin":"*","cache-control":"public, max-age=31536000, immutable","cross-origin-resource-policy":"cross-origin","access-control-expose-headers":"*","cf-cache-status":"HIT","x-robots-tag":"noindex","alt-svc":"h3=\":443\"; ma=86400","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=WNDfbL6E1IX7WIIkVXU4Au%2F8PVCplOLOTfEjr1IQ5PZS48reWCS0Gwzs0zddZzk4EI8mNvZn9p3eGCCuz5Inx7Eb3jBHDtzMin3B9iCKmBPs7xGtMX7%2BXBk%3D\"}]}","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","x-jsr-backend":"modules","accept-ranges":"bytes","cf-ray":"a223e657fb397db6-LAX","server":"cloudflare"},"url":"https://jsr.io/@std/fs/0.224.0/_to_path_string.ts","time":1785241875}