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

Function uploadToNest

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

Source from the content-addressed store, hash-verified

86}
87
88export async function uploadToNest(
89 _: IpcMainInvokeEvent,
90 fileBuffer: ArrayBuffer,
91 filename: string,
92 authToken: string
93): Promise<NativeUploadResult> {
94 try {
95 const response = await multipartFetch("https://nest.rip/api/files/upload", {}, "file", fileBuffer, filename, { Authorization: authToken });
96
97 if (!response.ok) {
98 const errorText = await response.text();
99 return { success: false, error: `Upload failed: ${response.status} ${errorText}` };
100 }
101
102 const data = await response.json() as NestUploadResponse;
103
104 if (data.fileURL) {
105 return { success: true, url: data.fileURL };
106 }
107
108 return { success: false, error: "No URL returned from upload" };
109 } catch (e) {
110 return { success: false, error: e instanceof Error ? e.message : "Unknown error" };
111 }
112}
113
114export async function uploadToEzHost(
115 _: IpcMainInvokeEvent,

Callers

nothing calls this directly

Calls 3

multipartFetchFunction · 0.85
textMethod · 0.80
jsonMethod · 0.80

Tested by

no test coverage detected