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.
Methods
Section titled “Methods”canonicalize()
Section titled “canonicalize()”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)
Parameters
Section titled “Parameters”string
Path to canonicalize
Returns
Section titled “Returns”string
Canonical path
readText()
Section titled “readText()”readText(
path):Promise<string>
Defined in: file-provider/types.ts:50
Read file contents as UTF-8 text
Parameters
Section titled “Parameters”string
Canonical file path
Returns
Section titled “Returns”Promise<string>
File contents as string
Throws
Section titled “Throws”FileNotFoundError if file doesn’t exist
Throws
Section titled “Throws”FileReadError if file cannot be read
resolve()
Section titled “resolve()”resolve(
fromFile,relativePath):string
Defined in: file-provider/types.ts:59
Resolve a relative path from a source file’s location
Parameters
Section titled “Parameters”fromFile
Section titled “fromFile”string
Canonical path of the file containing the reference
relativePath
Section titled “relativePath”string
Relative path to resolve (e.g., ”./foo.md”, ”../bar.md”)
Returns
Section titled “Returns”string
Canonical resolved path