MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / sourceFile

Function sourceFile

__tests__/bounded-source.test.ts:25–31  ·  view source on GitHub ↗
(bytes: Buffer)

Source from the content-addressed store, hash-verified

23
24const dirs: string[] = [];
25function sourceFile(bytes: Buffer): string {
26 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-bounded-'));
27 dirs.push(dir);
28 const file = path.join(dir, 'source.ts');
29 fs.writeFileSync(file, bytes);
30 return file;
31}
32
33afterEach(() => {
34 for (const dir of dirs.splice(0)) fs.rmSync(dir, { recursive: true, force: true });

Callers 1

Calls 2

pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected