feat: add file attachment

This commit is contained in:
kangfenmao
2024-09-18 18:00:49 +08:00
parent 6f5dccd595
commit 6e7e5cb1f1
32 changed files with 825 additions and 273 deletions
+3 -4
View File
@@ -24,12 +24,11 @@ declare global {
file: {
select: (options?: OpenDialogOptions) => Promise<FileType[] | null>
upload: (file: FileType) => Promise<FileType>
delete: (fileId: string) => Promise<{ success: boolean }>
delete: (fileId: string) => Promise<void>
read: (fileId: string) => Promise<string>
base64Image: (fileId: string) => Promise<{ mime: string; base64: string; data: string }>
clear: () => Promise<void>
}
image: {
base64: (filePath: string) => Promise<{ mime: string; base64: string; data: string }>
}
}
}
}
+2 -3
View File
@@ -20,10 +20,9 @@ const api = {
select: (options?: OpenDialogOptions) => ipcRenderer.invoke('file:select', options),
upload: (filePath: string) => ipcRenderer.invoke('file:upload', filePath),
delete: (fileId: string) => ipcRenderer.invoke('file:delete', fileId),
read: (fileId: string) => ipcRenderer.invoke('file:read', fileId),
base64Image: (fileId: string) => ipcRenderer.invoke('file:base64Image', fileId),
clear: () => ipcRenderer.invoke('file:clear')
},
image: {
base64: (filePath: string) => ipcRenderer.invoke('image:base64', filePath)
}
}