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

Function writeFile

apps/webuiapps/src/lib/fileApi.ts:222–232  ·  view source on GitHub ↗
(path: string, content: unknown)

Source from the content-addressed store, hash-verified

220 * TextFile: path (directory) / name (filename) / content
221 */
222export const writeFile = async (path: string, content: unknown): Promise<void> => {
223 const manager = getClientComManager();
224 const contentStr = typeof content === 'string' ? content : JSON.stringify(content);
225 const file = toTextFile(path, contentStr);
226 const startTime = ts();
227 const t0 = performance.now();
228 await manager.putTextFilesByJSON({ files: [file] });
229 console.info(
230 `[FileApi][${startTime}] writeFile "${file.path}/${file.name}" — ${(performance.now() - t0).toFixed(1)}ms`,
231 );
232};
233
234/**
235 * Delete file

Callers 1

createAppFileApiFunction · 0.70

Calls 5

getClientComManagerFunction · 0.90
toTextFileFunction · 0.85
tsFunction · 0.85
putTextFilesByJSONMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected