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

Function uploadToBuzzheavier

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

Source from the content-addressed store, hash-verified

304}
305
306export async function uploadToBuzzheavier(
307 _: IpcMainInvokeEvent,
308 fileBuffer: ArrayBuffer,
309 filename: string
310): Promise<NativeUploadResult> {
311 try {
312 const response = await rawFetch(`https://w.buzzheavier.com/${encodeURIComponent(filename)}`, "PUT", fileBuffer);
313
314 const text = await response.text();
315 if (!response.ok) {
316 return { success: false, error: `Upload failed: ${response.status} ${text}` };
317 }
318
319 try {
320 const data = JSON.parse(text) as { code?: number; data?: { id?: string; }; };
321 if (data.code === 201 && data.data?.id) {
322 return { success: true, url: `https://buzzheavier.com/${data.data.id}` };
323 }
324 } catch {
325 }
326
327 const url = text.trim();
328 if (!url) {
329 return { success: false, error: "No URL returned from upload" };
330 }
331
332 return { success: true, url };
333 } catch (e) {
334 return { success: false, error: e instanceof Error ? e.message : "Unknown error" };
335 }
336}
337
338export async function uploadToTempSh(
339 _: IpcMainInvokeEvent,

Callers

nothing calls this directly

Calls 2

rawFetchFunction · 0.85
textMethod · 0.80

Tested by

no test coverage detected