* 读取附件内容 * @param localPath 相对路径 * @returns base64编码的内容
(
localPath: string
)
| 54 | * @returns base64编码的内容 |
| 55 | */ |
| 56 | async readAttachment( |
| 57 | localPath: string |
| 58 | ): Promise<{ success: boolean; content?: string; error?: string }> { |
| 59 | try { |
| 60 | const content = await readAttachmentFile(localPath) |
| 61 | return { success: true, content } |
| 62 | } catch (error) { |
| 63 | console.error('读取附件失败:', error) |
| 64 | return { |
| 65 | success: false, |
| 66 | error: error instanceof Error ? error.message : '读取附件失败' |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * 删除附件 |
no test coverage detected