Node Webkit clear cache

前端 未结 3 712
南旧
南旧 2021-02-10 09:48

I recently discovered that c:/Users/username/AppData/Local/AppName/Cache contained over 100K cache files.

I read up a bit and saw that the gui.App.cl

3条回答
  •  隐瞒了意图╮
    2021-02-10 10:14

    Ran into the same issue so I created a quick solution to solve the problem temporarily until I can rely on the native gui.App.clearCache function. This removes the entire Cache directory and recreates it asynchronously.

    This requires fs-extra and should work on Linux, OSX and Windows.

    var customClearCache = function(){
      var dir = path.join(gui.App.dataPath, '/Cache');
      fs.remove(dir, function(err) {
        if (err) return console.error(err)
        fs.mkdirs(dir, function(err) {
          if (err) return console.error(err)
          // This is where I start my app
        });
      });
    };

提交回复
热议问题