如何从Firefox扩展中转储和转换索引DB sqlite数据库的二进制blob

问题描述 投票:2回答:1

我正在尝试使用IndexedDB转储Firefox扩展存储的所有数据。

由于Firefox索引数据库API的某些问题(请参见错误列表https://github.com/sienori/Tab-Session-Manager/issues/364),在升级插件/ firefox后,我所有使用扩展名tab session manager存储的firefox选项卡/窗口都完全消失了]

在这种情况下,我并不孤单。有一些恢复数据given by developper的策略,但是在我的情况下它们都可以工作。

此扩展名保存的选项卡/ Windows使用一个SQLITE文件存储,该文件位于我的firefox配置文件中:.../2y6ybf92.default/storage/default/moz-extension+++eddda785-9abb-4c35-8b00-921325674952/idb/1782160246ssensosi.sqlite

可以使用DB Browser for SQLITE打开数据库,所以我想数据库没有损坏。但是我不确定,因为正如您想象的那样,数据是以二进制格式存储的。...

我尝试使用dexie.js library和此示例转储数据库:https://github.com/dfahlander/Dexie.js/blob/master/samples/open-existing-db/dump-databases.html

 console.log("Dumping Databases");
        console.log("=================");
        Dexie.getDatabaseNames(function (databaseNames) {
            if (databaseNames.length === 0) {
                // No databases at this origin as we know of.
                console.log("There are no databases at current origin. Try loading another sample and then go back to this page.");
            } else {
                // At least one database to dump
                dump(databaseNames);
            }
            function dump(databaseNames) {
                if (databaseNames.length > 0) {
                    var db = new Dexie(databaseNames[0]);
                    // Now, open database without specifying any version. This will make the database open any existing database and read its schema automatically.
                    db.open().then(function () {
                        console.log("var db = new Dexie('" + db.name + "');");
                        console.log("db.version(" + db.verno + ").stores({");
                        db.tables.forEach(function (table, i) {
                            var primKeyAndIndexes = [table.schema.primKey].concat(table.schema.indexes);
                            var schemaSyntax = primKeyAndIndexes.map(function (index) { return index.src; }).join(',');
                            console.log("    " + table.name + ": " + "'" + schemaSyntax + "'" + (i < db.tables.length - 1 ? "," : ""));
                            // Note: We could also dump the objects here if we'd like to:
                            //  table.each(function (object) {
                            //      console.log(JSON.stringify(object));
                            //  });
                        });
                        console.log("});\n");
                    }).finally(function () {
                        db.close();
                        dump(databaseNames.slice(1));
                    });;
                } else {
                    console.log("Finished dumping databases");
                    console.log("==========================");
                }
            }
        });

Dexie使用Firefox和Chrome浏览器,找到位于转储数据库页面同一文件夹中的sqlite文件……”

是否可以使用dexie直接打开.sqlite文件?

您认为可能以可读格式转储和转换

使用dexie.js在此sqlite文件中由索引Db存储的所有(二进制)数据吗?如果没有,是否还有其他解决方案来检索我的数据?

我正在尝试使用IndexedDB转储Firefox扩展存储的所有数据。由于Firefox索引数据库API的某些问题(请参见错误列表https://github.com/sienori/Tab-Session-Manager/issues/364),所有...

javascript sqlite firefox firefox-addon indexeddb
1个回答
0
投票

Dexie.js的代码示例旨在用于转储IndexDB。可以找到on Github

© www.soinside.com 2019 - 2024. All rights reserved.