* Delete a YJS document from disk.
(id: string)
| 269 | * Delete a YJS document from disk. |
| 270 | */ |
| 271 | async function handleDelete(id: string): Promise<void> { |
| 272 | const filePath = getDocPath(id) |
| 273 | |
| 274 | try { |
| 275 | await fs.unlink(filePath) |
| 276 | logger.debug(`[YjsStorage] Deleted document: ${id}`) |
| 277 | } catch (error) { |
| 278 | if ((error as NodeJS.ErrnoException).code === "ENOENT") { |
| 279 | // Already deleted, ignore |
| 280 | return |
| 281 | } |
| 282 | throw error |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | export async function deleteYjsDocument(id: string): Promise<void> { |
| 287 | await handleDelete(id) |
no test coverage detected