How do you delete the indexed databases stored on your computer in Firefox?

前端 未结 9 519
暖寄归人
暖寄归人 2021-02-03 10:13

In Opera you can simply type in opera:webdatabases in the address field and delete all the web SQL databases stored on your computer.

How do you do the sam

9条回答
  •  暖寄归人
    2021-02-03 11:00

    Here is a node script that deletes the indexedDB directory for every website.

    C:\Users\\AppData\Roaming\Mozilla\Firefox\Profiles\<*>.default\indexedDB
    

    based on Aadit's answer.

        var userName = "myWindowsUserName";
    
    var fs = require("fs");
    var root = "C:\\Users\\" + userName + "\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\";
    var dir = fs.readdirSync(root);
    
    var deleteFolderRecursive = function (path) { // http://www.geedew.com/2012/10/24/remove-a-directory-that-is-not-empty-in-nodejs/
        if (fs.existsSync(path)) {
            fs.readdirSync(path).forEach(function (file, index) {
                var curPath = path + "/" + file;
                if (fs.statSync(curPath).isDirectory()) { // recurse
                    deleteFolderRecursive(curPath);
                } else { // delete file
                    fs.unlinkSync(curPath);
                }
            });
            fs.rmdirSync(path);
        }
    };
    
    var anyRemoved = false;
    for(var i = 0; i < dir.length; i++) {
      if(/\.default$/.test(dir[i])) {
        var idbPath = root + dir[i] + "\\indexedDB";
        var idbDir = fs.readdirSync(idbPath);
        for (var i2 = 0; i2 < idbDir.length; i2++) {
            anyRemoved = true;
            var rmDir = idbPath + "\\" + idbDir[i2];
            console.log("removing: " + rmDir);
            deleteFolderRecursive(rmDir);
        }
      }
    }
    if(anyRemoved === false)
      console.log("No indexedDB files were found.");
    
    setTimeout(function () { }, 1000 * 5);
    

提交回复
热议问题