MCPcopy Index your code
hub / github.com/markmap/markmap / addProvider

Method addProvider

packages/markmap-cli/src/util/dev-server.ts:303–314  ·  view source on GitHub ↗
(options?: { key?: string; filePath?: string })

Source from the content-addressed store, hash-verified

301 }
302
303 addProvider(options?: { key?: string; filePath?: string }) {
304 const filePath = options?.filePath && resolve(options.filePath);
305 const key =
306 options?.key ||
307 (filePath ? sha256(filePath) : Math.random().toString(36).slice(2, 9));
308 this.providers[key] ||= filePath
309 ? new FileSystemProvider(key, filePath, (callback: () => void) =>
310 this._watch(filePath, callback),
311 )
312 : new BufferContentProvider(key);
313 return this.providers[key];
314 }
315
316 delProvider(key: string) {
317 const provider = this.providers[key];

Callers 1

mainFunction · 0.80

Calls 2

_watchMethod · 0.95
sha256Function · 0.85

Tested by

no test coverage detected