(options: {
fileId: string
fileName: string
base64Content: string
pageId?: string
messageId?: string
})
| 81 | } |
| 82 | |
| 83 | export async function saveAttachmentFile(options: { |
| 84 | fileId: string |
| 85 | fileName: string |
| 86 | base64Content: string |
| 87 | pageId?: string |
| 88 | messageId?: string |
| 89 | }): Promise<string> { |
| 90 | const relativePath = buildStoredRelativePath( |
| 91 | options.fileId, |
| 92 | options.fileName, |
| 93 | options.pageId, |
| 94 | options.messageId |
| 95 | ) |
| 96 | const targetPath = await resolveAttachmentPath(relativePath) |
| 97 | |
| 98 | await mkdir(path.dirname(targetPath), { recursive: true }) |
| 99 | await writeFile(targetPath, Buffer.from(options.base64Content, 'base64')) |
| 100 | |
| 101 | return relativePath |
| 102 | } |
| 103 | |
| 104 | export async function readAttachmentFile(localPath: string): Promise<string> { |
| 105 | const targetPath = await resolveAttachmentPath(localPath) |
no test coverage detected