W-CF Documentation - v11.0.0
    Preparing search index...

    Interface DocumentContainer

    interface DocumentContainer {
        addFile(
            pData: string | ArrayBuffer | Blob,
            pFilename: string,
            pCompress?: boolean,
            pCacheable?: boolean,
        ): Promise<void>;
        addFileFromCache(pFilename: string, pCompress?: boolean): Promise<boolean>;
        addFileFromUrl(
            pUrl: string,
            pFilename: string,
            pBinary: boolean,
            pCompress?: boolean,
            pCacheable?: boolean,
        ): Promise<void>;
        getFile(pFilename: string, pBinary: false): Promise<string>;
        getFile(pFilename: string, pBinary: true): Promise<ArrayBuffer>;
        getFile(pFilename: string, pBinary: boolean): Promise<string | ArrayBuffer>;
        listFiles(pFolderPath?: string): Promise<string[]>;
    }

    Implemented by

    Index
    • Adds a binary or text file to the container.

      Parameters

      • pData: string | ArrayBuffer | Blob

        The data of the file.

      • pFilename: string

        Name of the file to add. May include a path. e.g. "textures/123.jpg". Has to be lowercase.

      • OptionalpCompress: boolean

        If true the file should be compressed (if supported by the implementation) otherwise the file should not be compressed. (Default: true)

      • OptionalpCacheable: boolean

        If true the file may be cached. The filename should be used as cache id in this case. (Default: false)

      Returns Promise<void>

    • Adds an already cached file to the container. True should be returned if the file was added, otherwise false (e.g. if the file was not found inside the cache).

      Parameters

      • pFilename: string

        Name of the file to add. May include a path. e.g. "textures/123.jpg". Has to be lowercase.

      • OptionalpCompress: boolean

        If true the file should be compressed (if supported by the implementation) otherwise the file should not be compressed. (Default: true)

      Returns Promise<boolean>

    • Adds a binary or text file to the container using an url.

      Parameters

      • pUrl: string

        The file url.

      • pFilename: string

        Name of the file to add. May include a path. e.g. "textures/123.jpg". Has to be lowercase.

      • pBinary: boolean

        If true the file containes binary data.

      • OptionalpCompress: boolean

        If true the file should be compressed (if supported by the implementation) otherwise the file should not be compressed. (Default: true)

      • OptionalpCacheable: boolean

        If true the file may be cached. The filename should be used as cache id in this case. (Default: false)

      Returns Promise<void>

    • Retrieves a binary or text file from the container. If the file doesn't exist the promise has to be rejected with an FileNotFoundError.

      Parameters

      • pFilename: string

        Name of the file. May include a path. e.g. "textures/123.jpg".

      • pBinary: false

        If true the file containes binary data and is returned as ArrayBuffer otherwise as string.

      Returns Promise<string>

    • Parameters

      • pFilename: string
      • pBinary: true

      Returns Promise<ArrayBuffer>

    • Parameters

      • pFilename: string
      • pBinary: boolean

      Returns Promise<string | ArrayBuffer>

    • Returns a list of files which are part of the given folder and its sub folders. The files are returned as a relative path including the file name. If the folder doesn't exist the promise has to be rejected with an FileNotFoundError.

      Parameters

      • OptionalpFolderPath: string

        Path of the folder.

      Returns Promise<string[]>