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

Method readAttachment

src/main/attachmentHandler.ts:70–85  ·  view source on GitHub ↗

* 读取附件内容 * @param localPath 相对路径 * @returns base64编码的内容

(
    localPath: string
  )

Source from the content-addressed store, hash-verified

68 * @returns base64编码的内容
69 */
70 async readAttachment(
71 localPath: string
72 ): Promise<{ success: boolean; content?: string; error?: string }> {
73 try {
74 const fullPath = path.join(this.attachmentsDir, localPath)
75 const buffer = await readFile(fullPath)
76 const base64 = buffer.toString('base64')
77 return { success: true, content: base64 }
78 } catch (error) {
79 console.error('读取附件失败:', error)
80 return {
81 success: false,
82 error: error instanceof Error ? error.message : '读取附件失败'
83 }
84 }
85 }
86
87 /**
88 * 删除附件

Callers 1

setupAttachmentHandlersFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected