Skip to content

Instantly share code, notes, and snippets.

@dpnishant
Created July 15, 2022 13:22
Show Gist options
  • Save dpnishant/63cd6d01acddf62c9ef11b03076f4a2f to your computer and use it in GitHub Desktop.
Save dpnishant/63cd6d01acddf62c9ef11b03076f4a2f to your computer and use it in GitHub Desktop.
dump indexedDB
const dbName = "users"; //
const tableName = "dbsignin"; //
const dbReq = indexedDB.open(dbName, 1);
const dumpTable = function(event) {
const db = dbReq.result;
const objectStore = db.transaction([tableName]).objectStore(tableName);
objectStore.openCursor().onsuccess = (event) => {
const cursor = event.target.result;
if (cursor) {
console.table(cursor);
cursor.continue();
}
}
};
dbReq.onupgradeneeded = dumpTable;
dbReq.onsuccess = dumpTable;
dbReq.onerror = function() {
console.error("Error", dbReq.error);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment