MCPcopy Create free account
hub / github.com/ScattrdBlade/bigFileUpload / uploadTo0x0

Function uploadTo0x0

native.ts:144–166  ·  view source on GitHub ↗
(
    _: IpcMainInvokeEvent,
    fileBuffer: ArrayBuffer,
    filename: string
)

Source from the content-addressed store, hash-verified

142}
143
144export async function uploadTo0x0(
145 _: IpcMainInvokeEvent,
146 fileBuffer: ArrayBuffer,
147 filename: string
148): Promise<NativeUploadResult> {
149 try {
150 const response = await multipartFetch("https://0x0.st", {}, "file", fileBuffer, filename);
151
152 if (!response.ok) {
153 const errorText = await response.text();
154 return { success: false, error: `Upload failed: ${response.status} ${errorText}` };
155 }
156
157 const text = (await response.text()).trim();
158 if (!text) {
159 return { success: false, error: "No URL returned from upload" };
160 }
161
162 return { success: true, url: text };
163 } catch (e) {
164 return { success: false, error: e instanceof Error ? e.message : "Unknown error" };
165 }
166}
167
168export async function uploadToS3(
169 _: IpcMainInvokeEvent,

Callers

nothing calls this directly

Calls 2

multipartFetchFunction · 0.85
textMethod · 0.80

Tested by

no test coverage detected