(
_: IpcMainInvokeEvent,
fileBuffer: ArrayBuffer,
filename: string
)
| 360 | } |
| 361 | |
| 362 | export 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 | |
| 384 | export async function uploadToPixelVault( |
| 385 | _: IpcMainInvokeEvent, |
nothing calls this directly
no test coverage detected