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

Function putBinaryFile

apps/webuiapps/src/lib/diskStorage.ts:99–114  ·  view source on GitHub ↗
(
  filePath: string,
  base64: string,
  mimeType: string,
)

Source from the content-addressed store, hash-verified

97 * Write a binary file (e.g. image) from base64 data.
98 */
99export async function putBinaryFile(
100 filePath: string,
101 base64: string,
102 mimeType: string,
103): Promise<void> {
104 const binary = atob(base64);
105 const bytes = new Uint8Array(binary.length);
106 for (let i = 0; i < binary.length; i++) {
107 bytes[i] = binary.charCodeAt(i);
108 }
109 await fetch(apiUrl(filePath), {
110 method: 'POST',
111 headers: { 'Content-Type': mimeType },
112 body: bytes,
113 });
114}
115
116export async function deleteFilesByPaths(data: { file_paths: string[] }): Promise<void> {
117 const promises = data.file_paths.map(async (filePath) => {

Callers

nothing calls this directly

Calls 1

apiUrlFunction · 0.70

Tested by

no test coverage detected