Reputation: 181
I am trying to export my IndexedDB database with Dexie in my Quasar project using dexie-export-import. I am brand new to Quasar and Dexie so please be kind to my lack of knowledge.
My code seems to be working and I'm not getting an error in my console, but I don't see that I'm getting anything exported, either. I'm wondering if an export is happening but I don't know where it's going?
I'm running Quasar via Electron as this will be a desktop app.
I'm also wondering that I may have to trigger a file download from Quasar? I appreciate any help. I have been searching online but I'm not able to find what I"m doing wrong.
This is a code snippet:
import {importDB, exportDB} from "dexie-export-import"
try {
const blob = await exportDB(myDB)
console.log(" in try ")
return blob
} catch (error) {
console.error(' error: '+error);
}
Upvotes: 0
Views: 756
Reputation: 5691
You need to present the blob you get to the user. One way (which is also the way used on this codepen example) is to use download-js and pass the blob to its download() function. This will trigger a "download" of the file content for the user.
const blob = await exportDB(myDB)
download(blob, "dexie-export.json", "application/json");
Upvotes: 1