function toFileUrl(path) {
  if (!isAbsolute(path)) {
    throw new TypeError("Must be an absolute path.");
  }
  const url = new URL("file:///");
  url.pathname = encodeWhitespace(
    path.replace(/%/g, "%25").replace(/\\/g, "%5C"),
  );
  return url;
}
/**
 * Converts a path string to a file URL.
 *
 *      toFileUrl("/home/foo"); // new URL("file:///home/foo")
 * @param path to convert to file URL
 */
Converts a path string to a file URL.
Converts a path string to a file URL .
function toFileUrl(path) {
  if (!isAbsolute(path)) {
    throw new TypeError("Must be an absolute path.");
  }
  const url = new URL("file:///");
  url.pathname = encodeWhitespace(
    path.replace(/%/g, "%25").replace(/\\/g, "%5C"),
  );
  return url;
}
function toFileUrl ( path ) { if ( ! isAbsolute ( path ) ) { throw new TypeError ( "Must be an absolute path." ) ; } const url = new URL ( "file:///" ) ; url . pathname = encodeWhitespace ( path . replace ( / % / g , "%25" ) . replace ( / \\ / g , "%5C" ) , ) ; return url ; }
Converts a path string to a file URL.
Converts a path string to a file URL .