Skip to content

FileProvider

Defined in: file-provider/types.ts:41

Minimal isomorphic file provider interface

All paths are expected to be canonical after canonicalize() is called. Implementations must ensure deterministic behavior for the same inputs.

canonicalize(path): string

Defined in: file-provider/types.ts:72

Convert a path to its canonical form

Canonical paths are:

  • Absolute (no relative segments)
  • Normalized (no . or .. segments)
  • Consistent across platform (forward slashes for web/memory)

string

Path to canonicalize

string

Canonical path


readText(path): Promise<string>

Defined in: file-provider/types.ts:50

Read file contents as UTF-8 text

string

Canonical file path

Promise<string>

File contents as string

FileNotFoundError if file doesn’t exist

FileReadError if file cannot be read


resolve(fromFile, relativePath): string

Defined in: file-provider/types.ts:59

Resolve a relative path from a source file’s location

string

Canonical path of the file containing the reference

string

Relative path to resolve (e.g., ”./foo.md”, ”../bar.md”)

string

Canonical resolved path