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

Function uploadToPixelVault

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

Source from the content-addressed store, hash-verified

382}
383
384export async function uploadToPixelVault(
385 _: IpcMainInvokeEvent,
386 fileBuffer: ArrayBuffer,
387 filename: string,
388 uploadKey: string
389): Promise<NativeUploadResult> {
390 try {
391 const response = await multipartFetch("https://pixelvault.co/", {}, "file", fileBuffer, filename, { Authorization: uploadKey });
392
393 const text = await response.text();
394 let data: { resource?: string; url?: string; } | null = null;
395
396 try {
397 data = text ? JSON.parse(text) : null;
398 } catch {
399 data = null;
400 }
401
402 if (!response.ok) {
403 return { success: false, error: `Upload failed: ${response.status} ${text}` };
404 }
405
406 const url = data?.resource || data?.url || text.trim();
407 if (!url) {
408 return { success: false, error: "No URL returned from upload" };
409 }
410
411 return { success: true, url };
412 } catch (e) {
413 return { success: false, error: e instanceof Error ? e.message : "Unknown error" };
414 }
415}
416
417export async function uploadToPixelDrain(
418 _: IpcMainInvokeEvent,

Callers

nothing calls this directly

Calls 2

multipartFetchFunction · 0.85
textMethod · 0.80

Tested by

no test coverage detected