@mendix/extensions-api - v0.2.4
    Preparing search index...

    Interface IAppFilesApi

    API for working with the files in the app directory.

    interface IAppFilesApi {
        _apiId: "mendix.AppFilesApi";
        addEventListener<K extends never>(
            eventType: K,
            listener: EventHandler<{}, K>,
        ): DisposeListener;
        deleteFile(path: string): Promise<void>;
        getFile(path: string): Promise<string>;
        getFiles(filter: string): Promise<string[]>;
        putFile(path: string, content: string): Promise<void>;
        removeEventListener<K extends never>(
            eventType: K,
            listener: EventHandler<{}, K>,
        ): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    _apiId: "mendix.AppFilesApi"

    Unique identifier that can be used to register or retrieve a specific API.

    Example: mendix.EditorsAPI, mycompany.MyFunkyAPI

    Methods

    • Adds an event listener for the specified event type.

      Type Parameters

      • K extends never

      Parameters

      • eventType: K

        The type of event to listen for.

      • listener: EventHandler<{}, K>

        The event listener to add.

      Returns DisposeListener

      A function that can be called to remove the event listener.

    • Deletes the file at the specified path.

      Parameters

      • path: string

        The relative path of the file to delete.

      Returns Promise<void>

      A promise that resolves when the file has been deleted.

    • Retrieves the content of a file at the specified path.

      Parameters

      • path: string

        The relative path of the file to retrieve.

      Returns Promise<string>

      A promise that resolves with the content of the file.

    • Retrieves a list of files matching the given glob filter.

      Parameters

      • filter: string

        The glob pattern to match app files against.

      Returns Promise<string[]>

    • Uploads content to a file at the specified path.

      Parameters

      • path: string

        The relative path of the file to upload content to.

      • content: string

        The content to upload to the file.

      Returns Promise<void>

      A promise that resolves when the file has been uploaded.

    • Removes an event listener for the specified event type.

      Type Parameters

      • K extends never

      Parameters

      • eventType: K

        The type of event to remove the listener from.

      • listener: EventHandler<{}, K>

        The event listener to remove.

      Returns void