Skip to content

probe-web / @probe-web/client / index / DirectorySourceProvider

Class: DirectorySourceProvider ​

Defined in: sources.ts:92

Serve sources from a directory the user picked (showDirectoryPicker()), matched by path suffix. The tree is indexed once (skipping target, node_modules and dot-directories); call reindex() after files are added.

Implements ​

Constructors ​

Constructor ​

ts
new DirectorySourceProvider(root, opts?): DirectorySourceProvider;

Defined in: sources.ts:100

maxFiles caps how many files are indexed (default 20 000), so picking a huge tree stays cheap.

Parameters ​

ParameterType
rootDirectoryHandleLike
opts{ maxFiles?: number; }
opts.maxFiles?number

Returns ​

DirectorySourceProvider

Properties ​

PropertyModifierTypeDescriptionDefined in
SKIPreadonlySet<string>Directory names never indexed (dot-directories are skipped as well).sources.ts:97

Methods ​

reindex() ​

ts
reindex(): void;

Defined in: sources.ts:106

Forget the index; the tree is walked again on the next lookup.

Returns ​

void


resolve() ​

ts
resolve(path): Promise<string | null>;

Defined in: sources.ts:133

The workspace-relative file path maps to (see matchSourcePath), or null.

Parameters ​

ParameterType
pathstring

Returns ​

Promise<string | null>

Implementation of ​

SourceProvider.resolve


read() ​

ts
read(path): Promise<string | null>;

Defined in: sources.ts:138

The text of the file path maps to, or null if none matches.

Parameters ​

ParameterType
pathstring

Returns ​

Promise<string | null>

Implementation of ​

SourceProvider.read