(dbPath: string)
| 88 | |
| 89 | // Delete a database |
| 90 | export async function deleteDb(dbPath: string): Promise<void> { |
| 91 | try { |
| 92 | await fs.unlink(dbPath); |
| 93 | console.log(`Database at ${dbPath} has been deleted.`); |
| 94 | } catch (error) { |
| 95 | if ((error as NodeJS.ErrnoException).code === 'ENOENT') { |
| 96 | console.log(`No database found at ${dbPath}. Nothing to delete.`); |
| 97 | } else { |
| 98 | throw error; |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | // Load a database |
| 104 | export async function loadDb(memoryName: string) { |