MCPcopy Create free account
hub / github.com/MiniMax-AI/OpenRoom / getFile

Function getFile

apps/webuiapps/src/lib/diskStorage.ts:54–68  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

52 * Read a file. Returns parsed JSON (if JSON file) or string content, or null if not found.
53 */
54export async function getFile(filePath: string): Promise<unknown> {
55 try {
56 const res = await fetch(apiUrl(filePath));
57 if (!res.ok) return null;
58 const text = await res.text();
59 try {
60 return JSON.parse(text);
61 } catch {
62 return text;
63 }
64 } catch (e) {
65 console.warn('[diskStorage] getFile failed:', e);
66 return null;
67 }
68}
69
70/**
71 * Write files. Compatible with the old putTextFilesByJSON signature.

Callers

nothing calls this directly

Calls 2

warnMethod · 0.80
apiUrlFunction · 0.70

Tested by

no test coverage detected