MCPcopy Create free account
hub / github.com/agenticsorg/edge-agents / writeFile

Function writeFile

scripts/sparc2/scripts/e2b-code-interpreter.ts:171–184  ·  view source on GitHub ↗
(path: string, content: string)

Source from the content-addressed store, hash-verified

169 * @param content Content to write
170 */
171export async function writeFile(path: string, content: string): Promise<void> {
172 const sandbox = await createSandbox();
173
174 try {
175 await sandbox.filesystem.write(path, content);
176 await logMessage("info", `File written to sandbox: ${path}`, { contentLength: content.length });
177 } catch (error: unknown) {
178 const errorMessage = error instanceof Error ? error.message : String(error);
179 await logMessage("error", `Failed to write file to sandbox: ${path}`, { error: errorMessage });
180 throw error;
181 } finally {
182 await sandbox.close();
183 }
184}
185
186/**
187 * Read a file from the sandbox

Callers 2

mainFunction · 0.90
mainFunction · 0.70

Calls 2

logMessageFunction · 0.90
createSandboxFunction · 0.70

Tested by

no test coverage detected