Created
July 15, 2022 13:22
-
-
Save dpnishant/63cd6d01acddf62c9ef11b03076f4a2f to your computer and use it in GitHub Desktop.
dump indexedDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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