Skip to main content

Interface: FileReader

Defined in: packages/core/src/application/ports/file-reader.ts:12

Port for reading arbitrary files from the filesystem.

Used by CompileContext (and similar use cases) to load file content by absolute path without coupling application logic to a concrete fs import. Returns null when the file does not exist, rather than throwing.

Unlike the repository ports, FileReader has no invariant constructor arguments shared across all implementations, so it is declared as an interface rather than an abstract class.

Methods

read()

read(absolutePath): Promise<string | null>

Defined in: packages/core/src/application/ports/file-reader.ts:19

Reads the UTF-8 text content of the file at absolutePath.

Parameters

absolutePath

string

The absolute filesystem path to read

Returns

Promise<string | null>

The file contents as a string, or null if the file does not exist