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

Function moveAttachmentFile

src/main/attachmentStorage.ts:119–143  ·  view source on GitHub ↗
(options: {
  fileId: string
  fileName: string
  fromPath: string
  pageId: string
  messageId: string
})

Source from the content-addressed store, hash-verified

117}
118
119export async function moveAttachmentFile(options: {
120 fileId: string
121 fileName: string
122 fromPath: string
123 pageId: string
124 messageId: string
125}): Promise<string> {
126 const sourcePath = await resolveAttachmentPath(options.fromPath)
127 if (!(await pathExists(sourcePath))) {
128 throw new Error(`Attachment source not found: ${options.fromPath}`)
129 }
130
131 const relativePath = buildStoredRelativePath(
132 options.fileId,
133 options.fileName,
134 options.pageId,
135 options.messageId
136 )
137 const targetPath = await resolveAttachmentPath(relativePath)
138
139 await mkdir(path.dirname(targetPath), { recursive: true })
140 await moveFile(sourcePath, targetPath)
141
142 return relativePath
143}
144
145export async function cleanupMessageAttachmentFiles(
146 pageId: string,

Callers 1

moveAttachmentMethod · 0.90

Calls 4

resolveAttachmentPathFunction · 0.85
buildStoredRelativePathFunction · 0.85
moveFileFunction · 0.85
pathExistsFunction · 0.70

Tested by

no test coverage detected