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

Function moveFile

src/main/attachmentStorage.ts:55–67  ·  view source on GitHub ↗
(sourcePath: string, targetPath: string)

Source from the content-addressed store, hash-verified

53}
54
55async function moveFile(sourcePath: string, targetPath: string): Promise<void> {
56 try {
57 await rename(sourcePath, targetPath)
58 } catch (error) {
59 const isCrossDeviceMove = (error as NodeJS.ErrnoException).code === 'EXDEV'
60 if (!isCrossDeviceMove) {
61 throw error
62 }
63
64 await copyFile(sourcePath, targetPath)
65 await unlink(sourcePath)
66 }
67}
68
69function resolveDirectoryWithinAttachmentsRoot(...segments: string[]): string {
70 const attachmentsRoot = getCurrentAttachmentsDirectory()

Callers 1

moveAttachmentFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected