Home > other >  export indexDB throws error "storeNames parameter was empty"
export indexDB throws error "storeNames parameter was empty"

Time:10-20

can anyone please help me out, I'm new to Dexie (Angular)

import Dexie from 'dexie';
import {ExportOptions, exportDB} from 'dexie-export-import';

const db = await new Dexie('myDB');
const blob = await exportDB(db);

I'm using exportDB method to export the indexDB with angular, but it gives me error like

InvalidAccessError: Failed to execute 'transaction' on 'IDBDatabase': The storeNames parameter was empty.

Instead of exportDB function I have also tried like

const blob = await db.export(options);

But it throws error like TypeError: db.export is not a function

CodePudding user response:

Try to call open on the database constructor:

import Dexie from 'dexie';
import { ExportOptions, exportDB } from 'dexie-export-import';

const exportDatabase = async (dbName) => { 
    const db = await new Dexie(dbName).open();
    const blob = await exportDB(db);
    return blob;
}
  • Related