https://github.com/blahah/electron-sane-cachepath
set the electron cache path to a sane default for the current OS
https://github.com/blahah/electron-sane-cachepath
Last synced: 4 months ago
JSON representation
set the electron cache path to a sane default for the current OS
- Host: GitHub
- URL: https://github.com/blahah/electron-sane-cachepath
- Owner: blahah
- License: cc0-1.0
- Created: 2017-07-08T18:44:31.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-08T18:52:49.000Z (almost 8 years ago)
- Last Synced: 2024-12-27T19:13:32.181Z (5 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
---
---
Sets the `electron` and `chromium` app base cache paths to sane defaults:
- `macOS`: `~/Library/Caches`
- `windows`: `process.env.APPDATA`
- `linux`: `process.env.XDG_CACHE_HOME` or `~/.cache`*note: the `cache` path is [now undocumented](https://github.com/electron/electron/commit/3d4318e15e757cf26377637ee1240d5b87cde39c) in `electron`, but it works as of electron `1.7.2`*
This module resolves the problem described in [this issue](https://github.com/electron/electron/issues/8124)
## Install
```
npm install --save electron-sane-cachepath
```## Usage
Just pass your electron `app` to the module's exported function **before app emits 'ready'**.
``` js
const { app } = require('electron')
require('electron-sane-cachepath')(app)
```An error will be thrown if:
- the `app` argument is missing
- the module is loaded in the renderer
- it is required on a platform other than `macOS`, `windows` or `linux`## License
To the extent possible by law, we transfer any rights we have in this code to the public domain. Specifically, we do so using the [CC0 1.0 Universal Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/).
You can do whatever you want with this code. No need to credit us, link to us, include any license, or anything else. But if you want to do those things, you're free to do that too.