Spaces:
Sleeping
Sleeping
Download src/lib/cloudUtils.ts from SeeMoon1/Mutsu-Studio-Cloud: direct link, hf CLI and curl.
- Browser
- Download file 685 Bytes
-
https://huggingface.co/spaces/SeeMoon1/Mutsu-Studio-Cloud/resolve/main/src/lib/cloudUtils.ts
- Command line
-
hf download hf://spaces/SeeMoon1/Mutsu-Studio-Cloud/src/lib/cloudUtils.ts
-
curl -L -o cloudUtils.ts https://huggingface.co/spaces/SeeMoon1/Mutsu-Studio-Cloud/resolve/main/src/lib/cloudUtils.ts
685 Bytes
| export const uploadImageToCloud = async (base64Data: string, meta: any) => { | |
| try { | |
| console.log("💾 Saving to Local Storage..."); | |
| const res = await fetch("/api/upload", { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify({ base64: base64Data }) | |
| }); | |
| if (!res.ok) { | |
| throw new Error(`Upload API Error: ${res.statusText}`); | |
| } | |
| const data = await res.json(); | |
| console.log("✅ Local Save Success:", data.url); | |
| return data.url; | |
| } catch (e) { | |
| console.error("Local Upload Failed:", e); | |
| return null; | |
| } | |
| }; |