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

Function write

__tests__/workspace-package-entries.test.ts:33–43  ·  view source on GitHub ↗
(root: string, files: Record<string, string | null>)

Source from the content-addressed store, hash-verified

31});
32
33function write(root: string, files: Record<string, string | null>): void {
34 for (const [rel, content] of Object.entries(files)) {
35 const file = path.join(root, rel);
36 if (content === null) {
37 fs.rmSync(file, { force: true });
38 continue;
39 }
40 fs.mkdirSync(path.dirname(file), { recursive: true });
41 fs.writeFileSync(file, content);
42 }
43}
44
45async function index(files: Record<string, string>): Promise<CodeGraph> {
46 const root = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-ws-entries-'));

Callers 2

indexFunction · 0.70

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected