Last active
December 2, 2016 06:46
-
-
Save Swivelgames/bd0b55495c13b18624b59d3e9aaa4fa9 to your computer and use it in GitHub Desktop.
Get All BrowserFS IndexedDB Data
This file contains hidden or 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
var res, ret; | |
db | |
.transaction(['browserfs'], 'readwrite') | |
.objectStore('browserfs') | |
.getAll() | |
.onsuccess = | |
(event) => { | |
res = event.target.result.map( (arrBuff) => { | |
if(arrBuff.byteLength !== 66) return new TextDecoder('utf-8').decode(new Uint8Array(arrBuff)); | |
return { | |
'id' : new TextDecoder('utf-8').decode(new Uint8Array(arrBuff.slice(30))), | |
'size' : (new Uint32Array(arrBuff.slice(0,4)))[0], | |
'mode' : (new Uint16Array(arrBuff.slice(4,6)))[0], | |
'atime': (new Float64Array(arrBuff.slice(6,14)))[0], | |
'mtime': (new Float64Array(arrBuff.slice(14,22)))[0], | |
'ctime': (new Float64Array(arrBuff.slice(22,30)))[0] | |
}; | |
}); | |
}; | |
db | |
.transaction(['browserfs'], 'readwrite') | |
.objectStore('browserfs') | |
.getAllKeys() | |
.onsuccess = | |
(event) => { | |
ret = {}; | |
event.target.result.forEach( (v,i) => { | |
ret[v] = res[i]; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After executing the above in the console, run
console.log(ret)
to view your IndexedDB data.