MCPcopy Create free account
hub / github.com/experdot/pointer / getAttachmentDataUrl

Function getAttachmentDataUrl

src/renderer/src/hooks/useAttachment.ts:221–227  ·  view source on GitHub ↗
(attachment: FileAttachment)

Source from the content-addressed store, hash-verified

219
220// 读取附件为 data URL(用于预览)
221export async function getAttachmentDataUrl(attachment: FileAttachment): Promise<string> {
222 const result = await window.api.attachment.read(attachment.localPath)
223 if (result.success && result.content) {
224 return `data:${attachment.type};base64,${result.content}`
225 }
226 throw new Error(result.error || 'Failed to read attachment')
227}
228
229// 独立的文件选择并保存函数(用于消息编辑等场景)
230export async function selectAndSaveAttachments(): Promise<FileAttachment[]> {

Callers 3

MessageAttachmentsFunction · 0.90
loadThumbnailFunction · 0.90
loadThumbnailFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected