MCPcopy Create free account
hub / github.com/ChromeDevTools/chrome-devtools-mcp / createTempFile

Function createTempFile

tests/utils.ts:572–595  ·  view source on GitHub ↗
(
  content: string,
  fileName: string,
  baseDir: string = os.tmpdir(),
)

Source from the content-addressed store, hash-verified

570}
571
572export function createTempFile(
573 content: string,
574 fileName: string,
575 baseDir: string = os.tmpdir(),
576): {
577 path: string;
578 [Symbol.dispose]: () => void;
579} {
580 const dirPath = fs.mkdtempSync(
581 path.join(baseDir, 'chrome-devtools-test-file-'),
582 );
583 const filePath = path.join(dirPath, fileName);
584 fs.writeFileSync(filePath, content);
585 return {
586 path: filePath,
587 [Symbol.dispose](): void {
588 try {
589 fs.rmSync(dirPath, {recursive: true, force: true});
590 } catch {
591 // ignore
592 }
593 },
594 };
595}

Callers 7

cli.test.tsFile · 0.85
McpServer.test.tsFile · 0.85
McpContext.test.tsFile · 0.85
input.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected