I have two tables in dexie database and I am trying to export-import only one of them with dexie-export-import.
Official dexie document says you have filter as optional parameter
//Optional filter allows to import/export subset of data
export interface ExportOptions {
noTransaction?: boolean;
numRowsPerChunk?: number;
prettyJson?: boolean;
filter?: (table: string, value: any, key?: any) => boolean;
progressCallback?: (progress: ExportProgress) => boolean;
}
well can any one show me how to use that filter parameter...
something like
database.export({prettyJson: true, filter: (table: 'A', value: '', key: '') => true});
import {exportDB} from "dexie-export-import";
function exportSingleTable(db, tableName) {
return exportDB(db, {filter: (table, value, key) => table === tableName});
}
exportSingleTable(yourDexieInstance, "yourTableNameToExport").then(blob => {
alert("done");
// Result is in blob
}).catch(error => {
alert("error: " + error);
});