pixi.js
    Preparing search index...

    Interface PathAdvanced

    Path utilities for working with URLs and file paths in a cross-platform way. All paths that are passed in will become normalized to have posix separators.

    import { path } from 'pixi.js';

    path.normalize('http://www.example.com/foo/bar/../baz'); // http://www.example.com/foo/baz
    interface Path {
        basename: (path: string, ext?: string) => string;
        delimiter: string;
        dirname: (path: string) => string;
        extname: (path: string) => string;
        getProtocol: (path: string) => string;
        hasProtocol: (path: string) => boolean;
        isAbsolute: (path: string) => boolean;
        isBlobUrl: (path: string) => boolean;
        isDataUrl: (path: string) => boolean;
        isUrl: (path: string) => boolean;
        join: (...paths: string[]) => string;
        joinExtensions: string[];
        normalize: (path: string) => string;
        parse: (
            path: string,
        ) => {
            base?: string;
            dir?: string;
            ext?: string;
            name?: string;
            root?: string;
        };
        rootname: (path: string) => string;
        sep: string;
        toAbsolute: (url: string, baseUrl?: string, rootUrl?: string) => string;
        toPosix: (path: string) => string;
    }
    Index

    Properties

    basename: (path: string, ext?: string) => string

    Returns the last portion of a path

    Type declaration

      • (path: string, ext?: string): string
      • Parameters

        • path: string

          The path to test

        • Optionalext: string

          Optional extension to remove

        Returns string

    delimiter: string
    dirname: (path: string) => string

    Returns the directory name of a path

    Type declaration

      • (path: string): string
      • Parameters

        • path: string

          The path to parse

        Returns string

    extname: (path: string) => string

    Returns the extension of the path, from the last occurrence of the . (period) character to end of string in the last portion of the path. If there is no . in the last portion of the path, or if there are no . characters other than the first character of the basename of path, an empty string is returned.

    Type declaration

      • (path: string): string
      • Parameters

        • path: string

          The path to parse

        Returns string

    getProtocol: (path: string) => string

    Returns the protocol of the path e.g. http://, https://, file:///, data:, blob:, C:/

    Type declaration

      • (path: string): string
      • Parameters

        • path: string

          The path to get the protocol from

        Returns string

    hasProtocol: (path: string) => boolean

    Checks if the path has a protocol e.g. http://, https://, file:///, data:, blob:, C:/ This will return true for windows file paths

    Type declaration

      • (path: string): boolean
      • Parameters

        • path: string

          The path to check

        Returns boolean

    isAbsolute: (path: string) => boolean

    Determines if path is an absolute path. Absolute paths can be urls, data urls, or paths on disk

    Type declaration

      • (path: string): boolean
      • Parameters

        • path: string

          The path to test

        Returns boolean

    isBlobUrl: (path: string) => boolean

    Checks if the path is a blob URL

    Type declaration

      • (path: string): boolean
      • Parameters

        • path: string

          The path to check

        Returns boolean

    isDataUrl: (path: string) => boolean

    Checks if the path is a data URL

    Type declaration

      • (path: string): boolean
      • Parameters

        • path: string

          The path to check

        Returns boolean

    isUrl: (path: string) => boolean

    Checks if the path is a URL e.g. http://, https://

    Type declaration

      • (path: string): boolean
      • Parameters

        • path: string

          The path to check

        Returns boolean

    join: (...paths: string[]) => string

    Joins all given path segments together using the platform-specific separator as a delimiter, then normalizes the resulting path

    Type declaration

      • (...paths: string[]): string
      • Parameters

        • ...paths: string[]

          The segments of the path to join

        Returns string

    joinExtensions: string[]
    normalize: (path: string) => string

    Normalizes the given path, resolving '..' and '.' segments

    Type declaration

      • (path: string): string
      • Parameters

        • path: string

          The path to normalize

        Returns string

    parse: (
        path: string,
    ) => {
        base?: string;
        dir?: string;
        ext?: string;
        name?: string;
        root?: string;
    }

    Parses a path into an object containing the 'root', dir, base, ext, and name properties.

    Type declaration

      • (
            path: string,
        ): {
            base?: string;
            dir?: string;
            ext?: string;
            name?: string;
            root?: string;
        }
      • Parameters

        • path: string

          The path to parse

        Returns { base?: string; dir?: string; ext?: string; name?: string; root?: string }

    rootname: (path: string) => string

    Returns the root of the path e.g. /, C:/, file:///, http://domain.com/

    Type declaration

      • (path: string): string
      • Parameters

        • path: string

          The path to parse

        Returns string

    sep: string
    toAbsolute: (url: string, baseUrl?: string, rootUrl?: string) => string

    Converts URL to an absolute path. When loading from a Web Worker, we must use absolute paths. If the URL is already absolute we return it as is If it's not, we convert it

    Type declaration

      • (url: string, baseUrl?: string, rootUrl?: string): string
      • Parameters

        • url: string

          The URL to test

        • OptionalbaseUrl: string

          The base URL to use

        • OptionalrootUrl: string

          The root URL to use

        Returns string

    toPosix: (path: string) => string

    Converts a path to posix format.

    Type declaration

      • (path: string): string
      • Parameters

        • path: string

          The path to convert to posix

        Returns string