MCPcopy
hub / github.com/coder/mux / readFilePrefix

Method readFilePrefix

src/node/services/memoryService.ts:360–369  ·  view source on GitHub ↗
(relPath: string, maxBytes: number)

Source from the content-addressed store, hash-verified

358 }
359
360 async readFilePrefix(relPath: string, maxBytes: number): Promise<string> {
361 const handle = await fsPromises.open(this.abs(relPath), "r");
362 try {
363 const buffer = Buffer.alloc(maxBytes);
364 const { bytesRead } = await handle.read(buffer, 0, maxBytes, 0);
365 return buffer.subarray(0, bytesRead).toString("utf-8");
366 } finally {
367 await handle.close();
368 }
369 }
370
371 async writeFile(relPath: string, content: string): Promise<void> {
372 const absPath = this.abs(relPath);

Callers

nothing calls this directly

Calls 4

absMethod · 0.95
closeMethod · 0.65
openMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected