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

Function putTextFilesByJSON

apps/webuiapps/src/lib/diskStorage.ts:74–91  ·  view source on GitHub ↗
(data: {
  files: Array<{ path?: string; name?: string; content?: string }>;
})

Source from the content-addressed store, hash-verified

72 * files: [{ path: "directory", name: "filename", content: "..." }]
73 */
74export async function putTextFilesByJSON(data: {
75 files: Array<{ path?: string; name?: string; content?: string }>;
76}): Promise<void> {
77 const promises = data.files.map(async (file) => {
78 const fullPath = file.path ? `${file.path}/${file.name}` : file.name || '';
79 if (!fullPath) return;
80 try {
81 await fetch(apiUrl(fullPath), {
82 method: 'POST',
83 headers: { 'Content-Type': 'text/plain' },
84 body: file.content || '',
85 });
86 } catch (e) {
87 console.warn('[diskStorage] putTextFilesByJSON write failed:', e);
88 }
89 });
90 await Promise.all(promises);
91}
92
93/**
94 * Delete files by paths.

Callers

nothing calls this directly

Calls 2

warnMethod · 0.80
apiUrlFunction · 0.70

Tested by

no test coverage detected