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

Function uploadToFilebin

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

Source from the content-addressed store, hash-verified

360}
361
362export async function uploadToFilebin(
363 _: IpcMainInvokeEvent,
364 fileBuffer: ArrayBuffer,
365 filename: string
366): Promise<NativeUploadResult> {
367 try {
368 const binId = `${Date.now().toString(16)}${Math.random().toString(16).slice(2, 10)}`;
369 const uploadUrl = `https://filebin.net/${binId}/${encodeURIComponent(filename)}`;
370
371 const response = await multipartFetch(uploadUrl, {}, "file", fileBuffer, filename);
372
373 if (!response.ok) {
374 const errorText = await response.text();
375 return { success: false, error: `Upload failed: ${response.status} ${errorText}` };
376 }
377
378 return { success: true, url: `https://filebin.net/${binId}/${encodeURIComponent(filename)}` };
379 } catch (e) {
380 return { success: false, error: e instanceof Error ? e.message : "Unknown error" };
381 }
382}
383
384export async function uploadToPixelVault(
385 _: IpcMainInvokeEvent,

Callers

nothing calls this directly

Calls 2

multipartFetchFunction · 0.85
textMethod · 0.80

Tested by

no test coverage detected