An object that resolves relative URLs.

interface IResolver {
    isLocal?: (url: string, allowRoot?: boolean) => boolean;
    resolvePath?: (
        path: string,
    ) => Promise<null | IRenderMime.IResolvedLocation>;
    getDownloadUrl(url: string): Promise<string>;
    resolveUrl(url: string): Promise<string>;
}

Hierarchy (View Summary)

Properties

isLocal?: (url: string, allowRoot?: boolean) => boolean

Whether the URL should be handled by the resolver or not.

Type declaration

    • (url: string, allowRoot?: boolean): boolean
    • Parameters

      • url: string
      • OptionalallowRoot: boolean

        Whether the paths starting at Unix-style filesystem root (/) are permitted.

        This is similar to the isLocal check in URLExt, but can also perform additional checks on whether the resolver should handle a given URL.

      Returns boolean

resolvePath?: (path: string) => Promise<null | IRenderMime.IResolvedLocation>

Resolve a path from Jupyter kernel to a path:

  • relative to root_dir (preferably) this is in jupyter-server scope,
  • path understood and known by kernel (if such a path exists). Returns null if there is no file matching provided path in neither kernel nor jupyter-server contents manager.

Methods

  • Get the download url for a given absolute url path.

    This URL may include a query parameter.

    Parameters

    • url: string

    Returns Promise<string>

  • Resolve a relative url to an absolute url path.

    Parameters

    • url: string

    Returns Promise<string>