Angular Modernizer
    Preparing search index...

    In-memory file system adapter for testing. All operations are performed on an in-memory Map, enabling:

    • Fast, isolated tests without I/O
    • No cleanup required
    • Predictable test behavior

    Usage in tests:

    const fs = new InMemoryFileSystemAdapter();
    await fs.writeFile('/test/file.ts', 'content');
    const content = await fs.readFile('/test/file.ts');

    Implements

    Index

    Constructors

    Methods

    • Test utility: Clear all files from memory. Useful for resetting state between tests.

      Returns void

    • Copies stored content to a new path.

      Parameters

      • srcPath: string
      • destPath: string

      Returns void

      Error if the source file is not in memory

    • Create a directory (and parent directories if needed).

      Parameters

      • _path: string

        Directory path to create

      Returns Promise<void>

      Error if directory cannot be created

    • Delete a file.

      Parameters

      • path: string

        Path to the file to delete

      Returns Promise<void>

      Error if file doesn't exist or cannot be deleted

    • Removes a file from memory.

      Parameters

      • path: string

      Returns void

      Error if the file is not in memory

    • Check if a path points to a directory.

      Parameters

      • _path: string

        Path to check

      Returns Promise<boolean>

      Promise resolving to true if path is a directory, false otherwise

    • Always false: directories are not tracked.

      Parameters

      • _dirPath: string

      Returns boolean

    • Check if a file or directory exists.

      Parameters

      • path: string

        Path to check

      Returns Promise<boolean>

      Promise resolving to true if exists, false otherwise

    • Check if a path points to a file (not a directory).

      Parameters

      • path: string

        Path to check

      Returns Promise<boolean>

      Promise resolving to true if path is a file, false otherwise

    • Returns true when the path is stored.

      Parameters

      • filePath: string

      Returns boolean

    • Test utility: Get all file paths currently in memory. Useful for debugging and assertions in tests.

      Returns string[]

    • Always returns /.

      Returns string

    • Returns the current time as mtime and the UTF-8 byte length as size.

      Parameters

      • path: string

      Returns Promise<{ mtime: number; size: number }>

      Error if the file is not in memory

    • Not implemented: always returns an empty array.

      Parameters

      • _patterns: readonly string[]

      Returns string[]

    • Always true: paths are compared as stored.

      Returns boolean

    • No-op: directories are implicit.

      Parameters

      • _dirPath: string

      Returns void

    • Moves stored content to a new path.

      Parameters

      • srcPath: string
      • destPath: string

      Returns void

      Error if the source file is not in memory

    • List all files in a directory (non-recursive).

      Parameters

      • path: string

        Directory path

      Returns Promise<string[]>

      Promise resolving to array of file/directory names

      Error if directory doesn't exist or cannot be read

    • Lists the files directly below a directory path. Subdirectories are not reported.

      Parameters

      • dirPath: string

      Returns RuntimeDirEntry[]

    • Read a file's contents as a UTF-8 string.

      Parameters

      • path: string

        Absolute or relative path to the file

      Returns Promise<string>

      Promise resolving to file contents

      Error if file doesn't exist or cannot be read

    • Returns the stored content; the encoding is ignored.

      Parameters

      • filePath: string
      • Optional_encoding: string

      Returns string

      Error if the file is not in memory

    • Returns the path unchanged.

      Parameters

      • path: string

      Returns string

    • Test utility: Get the number of files in memory.

      Returns number

    • Write content to a file, creating directories if needed.

      Parameters

      • path: string

        Absolute or relative path to the file

      • content: string

        String content to write

      Returns Promise<void>

      Error if write operation fails

    • Stores the content under the given path.

      Parameters

      • filePath: string
      • fileText: string

      Returns void