code: function toPathIfFileURL(fileURLOrPath) {
    if (!(fileURLOrPath &&
      fileURLOrPath.protocol &&
      fileURLOrPath.pathname)) {
      return fileURLOrPath;
    }
  
    if (fileURLOrPath.protocol !== 'file:') {
      throw new Errors.EINVAL('only file: URLs are supported for paths', fileURLOrPath);
    }
  
    const pathname = fileURLOrPath.pathname;
    for (let n = 0; n < pathname.length; n++) {
      if (pathname[n] === '%') {
        const third = pathname.codePointAt(n + 2) | 0x20;
        if (pathname[n + 1] === '2' && third === 102) {
          throw new Errors.EINVAL('file: URLs must not include encoded / characters', fileURLOrPath);
        }
      }
    }
  
    return decodeURIComponent(pathname);
  }
docs: Get a path (String) from a file:// URL. Support URL() like objects https://github.com/nodejs/node/blob/968e901aff38a343b1de4addebf79fd8fa991c59/lib/internal/url.js#L1381