evalution
    Preparing search index...

    Class MemoryFileProvider

    An in-memory FileProvider backed by a Map<string, string>.

    Intended for unit tests and non-local environments (e.g. a browser or service-worker bundle) — all file I/O stays in-process with no disk access. It depends only on node:path and minimatch, so it carries no Node-only runtime dependencies (no node:fs, chokidar, etc.). Calling writeFile triggers any active watch callbacks synchronously, making it easy to test reactive code paths.

    const provider = new MemoryFileProvider({
    '/virtual/prompt.ts': 'export function myPrompt() { ... }',
    });
    const content = await provider.readFile('/virtual/prompt.ts');

    Implements

    Index

    Constructors

    Methods

    • Deletes the file at filePath. When the path falls inside an active watch scope, the watcher callback is invoked automatically with 'remove'.

      Parameters

      • filePath: string

      Returns Promise<void>

    • Dynamically imports the module at filePath and returns its namespace object. Rejects if the file does not exist.

      Parameters

      • filePath: string

      Returns Promise<any>

    • Reads the file at filePath and returns its content as a UTF-8 string. Rejects if the file does not exist.

      Parameters

      • filePath: string

      Returns Promise<string>

    • Writes content to filePath, creating or overwriting the file. When the path falls inside an active watch scope, the watcher callback is invoked automatically.

      Parameters

      • filePath: string
      • content: string

      Returns Promise<void>