Chr*_*ris 32 google-chrome node.js indexeddb leveldb levelup
我想使用Google Chrome的IndexedDB在客户端保留数据.
想法是稍后通过Node.JS访问chrome之外的IndexedDB.背景是在本地跟踪使用行为并将收集的数据存储在客户端上以供以后分析而无需服务器后端的想法.
根据我的理解,indexedDB是作为LevelDB实现的.但是,我不能与任何类似的工具/库的开启性LevelDB 的LevelUp/LevelDown或性LevelDB JSON的.
我总是收到此错误消息:
leveldb-dump-to-json --file test.json --db https_www.reddit.com_0.indexeddb.leveldb
events.js:141
throw er; // Unhandled 'error' event
^ OpenError: Invalid argument: idb_cmp1 does not match existing comparator : leveldb.BytewiseComparator
at /usr/local/lib/node_modules/leveldb- json/node_modules/levelup/lib/levelup.js:114:34 Christians-Air:IndexedDB
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?似乎Chrome实现在某种程度上是特殊/不同的.
Jos*_*ell 37
leveldb中的键是任意二进制序列.客户端实现比较器以定义键之间的排序.leveldb 的默认比较器相当于strncmp.Chrome的Indexed DB商店的比较器更复杂.如果你尝试使用不同于你创建的比较器的leveldb实例,你会以看似随机的顺序观察键,插入将是不可预测的或导致腐败 - 狗和猫生活在一起,大规模歇斯底里.所以leveldb允许你命名比较器(持久化到数据库)以帮助检测并避免这个错误,这就是你所看到的.Chrome的代码为Indexed DB "idb_cmp1" 命名其比较器.
要检查Chrome之外的Chrome的Indexed DB leveldb实例之一,您需要实现兼容的比较器.该代码存在于Chrome在content/browser/indexed_db/indexed_db_backing_store.cc中的实现中 - 请注意,不能保证在各版本中修复此问题.(当然,除了向后兼容性)
| 归档时间: |
|
| 查看次数: |
8233 次 |
| 最近记录: |