Node Webkit clear cache

前端 未结 3 715
南旧
南旧 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:23

    It is now 2019 and clearCache() does function by adding the following:

    var gui = require('nw.gui'); 
    gui.App.clearCache();
    

    or

    nw.App.clearCache();
    

    This will clear the HTTP cache in memory and the one on disk whatever your platform. I have tested it on Mac OS but maybe there can be user permission issues on Linux.

    On MacOS, you can check in real time that the cache folder is emptied at ‎⁨

    Mac HD⁩ ▸ ⁨Users⁩ ▸ youruser ▸ ⁨Library⁩ ▸ ⁨Caches⁩ ▸ ⁨yourapp ▸ ⁨Default⁩

提交回复
热议问题