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

Function readFile

scripts/sparc2/scripts/e2b-code-interpreter.ts:191–205  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

189 * @returns The file content
190 */
191export async function readFile(path: string): Promise<string> {
192 const sandbox = await createSandbox();
193
194 try {
195 const content = await sandbox.filesystem.read(path);
196 await logMessage("info", `File read from sandbox: ${path}`, { contentLength: content.length });
197 return content;
198 } catch (error: unknown) {
199 const errorMessage = error instanceof Error ? error.message : String(error);
200 await logMessage("error", `Failed to read file from sandbox: ${path}`, { error: errorMessage });
201 throw error;
202 } finally {
203 await sandbox.close();
204 }
205}
206
207/**
208 * List files in the sandbox

Callers 2

mainFunction · 0.90
mainFunction · 0.70

Calls 2

logMessageFunction · 0.90
createSandboxFunction · 0.70

Tested by

no test coverage detected