* 清理指定页面的所有附件 * @param pageId 页面ID
(pageId: string)
| 166 | * @param pageId 页面ID |
| 167 | */ |
| 168 | async cleanupPageAttachments(pageId: string): Promise<{ success: boolean; error?: string }> { |
| 169 | try { |
| 170 | const targetDir = path.join(this.attachmentsDir, pageId) |
| 171 | await rm(targetDir, { recursive: true, force: true }) |
| 172 | return { success: true } |
| 173 | } catch (error) { |
| 174 | console.error('清理页面附件失败:', error) |
| 175 | return { |
| 176 | success: false, |
| 177 | error: error instanceof Error ? error.message : '清理页面附件失败' |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * 清理临时目录中的所有文件 |
no outgoing calls
no test coverage detected