How to access Google Chrome’s IndexedDB/LevelDB files?

Keys in leveldb are arbitrary binary sequences. Clients implement comparators to define ordering between keys. The default comparator for leveldb is something equivalent to strncmp. Chrome’s comparator for Indexed DB’s store is more complicated. If you try and use a leveldb instance with a different comparator than it was created with you’ll observe keys in seemingly random order, insertion would be unpredictable or cause corruption – dogs and cats living together, mass hysteria. So leveldb lets you name the comparator (persisted to the database) to help detect and avoid this mistake, which is what you’re seeing. Chrome’s code names its comparator for Indexed DB “idb_cmp1”.

To inspect one of Chrome’s Indexed DB leveldb instances outside of chrome you’d need to implement a compatible comparator. The code lives in Chrome’s implementation at content/browser/indexed_db/indexed_db_backing_store.cc – and note that there’s no guarantee that this is fixed across versions. (Apart from backwards compatibility, of course)

Leave a Comment