The chrome-extension: can map a extension URL request to real file path.
324061
function (request, callback) {
  const parsed = url.parse(request.url)
  if (!parsed.hostname || !parsed.path) return callback()

  const manifest = manifestMap[parsed.hostname]
  if (!manifest) return callback()

  const page = backgroundPages[parsed.hostname]
  if (page && parsed.path === `/${page.name}`) {
    // Disabled due to false positive in StandardJS
    // eslint-disable-next-line standard/no-callback-literal
    return callback({
      mimeType: 'text/html',
      data: page.html
    })
  }

  fs.readFile(path.join(manifest.srcDirectory, parsed.path), function (err, content) {
    if (err) {
      // Disabled due to false positive in StandardJS
      // eslint-disable-next-line standard/no-callback-literal
      return callback(-6) // FILE_NOT_FOUND
    } else {
      return callback(content)
    }
  })
}
521538
def real_path(aPath)
			(path = Pathname.new(::File.expand_path(aPath))) && path.realpath.to_s
		end
404407
public static String getUrlExtension(String url) {
        String extension = MimeTypeMap.getFileExtensionFromUrl(url);
        return TextUtils.isEmpty(extension) ? "" : extension;
    }
371404
function mimeType( path ) {
	var extension = path.replace( /.*[./\\]/ , '' ).toLowerCase() ;

	if ( ! mimeType.extension[ extension ] ) {
		// default MIME type, when nothing is found
		return 'application/octet-stream' ;
	}

	return mimeType.extension[ extension ] ;
}
1009309
def url2tmp(self, root, url):
        
        filename = url.rsplit('/', 1)[-1]
        return os.path.join(root, filename)
1205473
function realRequirPath(filePath) {
  // console.log('realRequirPath:filePath: ' + filePath);
  var jsFilePath = filePath + '.js';
  if (fs.existsSync(filePath)) {
    if (fs.statSync(filePath).isDirectory()) {
      jsFilePath = filePath + '.js';
      if (fs.existsSync(jsFilePath)) {
        return jsFilePath;
      } else {
        jsFilePath = path.join(filePath, 'index.js');
      }
      // console.log('realRequirPath:jsFilePath: ' + jsFilePath);
    } else if (fs.statSync(filePath).isFile()) {
      return filePath;
    } else {
      return null;
    }
  } else {
    jsFilePath = filePath + '.js';
    // console.log('realRequirPath:filePath: ' + filePath);
  }

  if (fs.existsSync(jsFilePath)) {
    // console.log('realRequirPath:filePath: ' + filePath);
    return jsFilePath;
  } else {
    return null;
  }
}
890337
function getorigPath(filePath, base) {
    var extName = path.extname(filePath);
    var pt = path.resolve(base, filePath);
    if (!extName) pt += '.js';
    return pt;
}
1278192
function makeUrl(s) {
  var search = window.location.search;

  // Remove previous grep query parameter if present
  if (search) {
    search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?');
  }

  return (
    window.location.pathname +
    (search ? search + '&' : '?') +
    'grep=' +
    encodeURIComponent(escapeRe(s))
  );
}
1104521
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);
}
56098
function getExtension(url) {
    var a = url.split('.');

    if (a.length === 1 || (a[0] === '' && a.length === 2))
      return '';
    return a.pop();
  }
613275
def _extractPathFromUrl(url):
        
        if url.netloc != '' and url.netloc != 'localhost':
            raise RuntimeError("The URL '%s' is invalid" % url.geturl())
        return url.netloc + url.path
506789
function( absUrl, triggerData, settings, deferred ) {
            var fileUrl = this._createFileUrl( absUrl );

            return $.proxy(function( html, textStatus, xhr ) {
                //pre-parse html to check for a data-url,
                //use it as the new fileUrl, base path, etc
                var content,

                    // TODO handle dialogs again
                    pageElemRegex = new RegExp( "(<[^>]+\\bdata-" + this._getNs() + "role=[\"']?page[\"']?[^>]*>)" ),

                    dataUrlRegex = new RegExp( "\\bdata-" + this._getNs() + "url=[\"']?([^\"'>]*)[\"']?" );

                // data-url must be provided for the base tag so resource requests
                // can be directed to the correct url. loading into a temprorary
                // element makes these requests immediately
                if ( pageElemRegex.test( html ) &&
                    RegExp.$1 &&
                    dataUrlRegex.test( RegExp.$1 ) &&
                    RegExp.$1 ) {
                    fileUrl = $.mobile.path.getFilePath( $("<div>" + RegExp.$1 + "</div>").text() );

                    // We specify that, if a data-url attribute is given on the page div, its value
                    // must be given non-URL-encoded. However, in this part of the code, fileUrl is
                    // assumed to be URL-encoded, so we URL-encode the retrieved value here
                    fileUrl = this.window[ 0 ].encodeURIComponent( fileUrl );
                }

                //dont update the base tag if we are prefetching
                if ( settings.prefetch === undefined ) {
                    this._getBase().set( fileUrl );
                }

                content = this._parse( html, fileUrl );

                this._setLoadedTitle( content, html );

                // Add the content reference and xhr to our triggerData.
                triggerData.xhr = xhr;
                triggerData.textStatus = textStatus;

                // DEPRECATED
                triggerData.page = content;

                triggerData.content = content;

                triggerData.toPage = content;

                // If the default behavior is prevented, stop here!
                // Note that it is the responsibility of the listener/handler
                // that called preventDefault(), to resolve/reject the
                // deferred object within the triggerData.
                if ( this._triggerWithDeprecated( "load", triggerData ).event.isDefaultPrevented() ) {
                    return;
                }

                // rewrite src and href attrs to use a base url if the base tag won't work
                if ( this._isRewritableBaseTag() && content ) {
                    this._getBase().rewrite( fileUrl, content );
                }

                this._include( content, settings );

                // Remove loading message.
                if ( settings.showLoadMsg ) {
                    this._hideLoading();
                }

                deferred.resolve( absUrl, settings, content );
            }, this);
        }
247198
function (req, bucket, content) {
                var location = getLocation(req),
                    href = location.origin;
                
                // If the objectKey is a folder we want to get a url to the bucket with a prefix param
                if (content.Key.substr(-1) === '/' && content.Size === 0) {
                    // Merge marker property with existing queries
                    location.search = getMergedSearch(req.query, {
                        prefix: encodeURI(content.Key)
                    });
                    href += location.search;
                } else {
                // Since we are getting a link for an item the href must end with slash
                    if (href.substr(-1) !== '/') {
                        href += '/';
                    }
                    href += encodeURI(content.Key);
                }
                
                return href;
            }
1372115
function processFile(extension) {
  return (file, callback) => {
    let filePath;
    if (file.meta !== undefined && file.meta.filePath !== undefined) {
      const ext = extension === null
        ? file.meta.filePath.ext
        : extension;
      filePath = path.format(Object.assign({}, file.meta.filePath, { ext }));
    } else {
      filePath = extension === undefined
        ? file.path
        : `${trimExtension(file.path)}${extension}`;
    }

    async.nextTick(callback, null, Object.assign({}, file, { path: filePath }));
  };
}
573506
function url(path) {
        if (path) {
            if (_.startsWith(path, "/")) {
                if (!_urlPrefix) {
                    // lets discover the base url via the base html element
                    _urlPrefix = $('base').attr('href') || "";
                    if (_.endsWith(_urlPrefix, '/')) {
                        _urlPrefix = _urlPrefix.substring(0, _urlPrefix.length - 1);
                    }
                }
                if (_urlPrefix) {
                    return _urlPrefix + path;
                }
            }
        }
        return path;
    }
819777
def http_url(full_name, prefix)
      path = full_name.dup

      path.gsub!(/<<\s*(\w*)/, 'from-\1') if path['<<']

      ::File.join(prefix, path.split("::")) + ".html"
    end
451710
public static String getExtension(String url) {
        url = TextUtils.isEmpty(url) ? "" : url.toLowerCase();
        String extension = MimeTypeMap.getFileExtensionFromUrl(url);
        return TextUtils.isEmpty(extension) ? "" : extension;
    }