import { projectClient } from '../../client/client'; export async function uploadFile({ bucketName, 'objectPath+': key, file, }: { bucketName: string; 'objectPath+': string; file: Blob; }): Promise { const uploadUrl = await projectClient('/z3/{bucketName}/{objectPath+}').post({ action: 'upload', bucketName, 'objectPath+': key, }); await fetch(uploadUrl.signedUrl, { method: 'PUT', body: file, }); } export async function downloadFile({ bucketName, 'objectPath+': key, }: { bucketName: string; 'objectPath+': string; }): Promise { const uploadUrl = await projectClient('/z3/{bucketName}/{objectPath+}').post({ action: 'download', bucketName, 'objectPath+': key, }); const resp = await fetch(uploadUrl.signedUrl, { method: 'GET', }); if (!resp.ok) { throw new Error('Failed to download file'); } return resp.arrayBuffer(); }