The Electron, as I said before in a commenting, is based on Chromium, as well as Chrome, Opera, Bravo, etc.
So the application created in HTML+CSS+JS is actually a hybrid application, IE, your program is a browser "disguised as a normal program", these folders are all used by the technologies you have in engines of Chromium, see Devtools:
To change the location you need to use app.setPath(name, path)
using the value of name
as userData
:
app.setPath('userData', '/pasta/foo/bar');
Being /pasta/foo/bar
the new location of these folders, of course it is an example. However I must make it clear that the best place to keep temporary files is in the user folder, so I see no reason to change, what you can do if you really want to change (which I insist seems dispensable) is to take the value of userData
with app.getPath('userData')
and apply as sub-folder:
const userData = app.setPath('userData', '/pasta/foo/bar');
app.setPath('userData', `${userData}/chromium`);
I haven’t tested, but I may have to create the folder manually, so if it doesn’t work:
var fs = require('fs');
const userData = app.setPath('userData', '/pasta/foo/bar');
try {
fs.mkdirSync(`${userData}/chromium`);
} catch (ee) {
if (ee.code !== 'EEXIST') {
throw e; //Se o erro não for sobre existir então irá emitir um erro e seu programa não irá iniciar
}
}
app.setPath('userData', `${userData}/chromium`);
Note: You can even erase, but the engines will generate again and you can be sure that there are folders that haven’t appeared yet because your application hasn’t used things like:
I did not find details of all folders, but here goes almost everything:
blob_storage
probably to control the blobs generated as with the use of the API Blob
or URL.createObjectURL
Cache
contain HTTP request caching (it depends on how you configure your project)
Code Cache
this I do not know how it works for sure, but it seems that are caches of structures JS and wasm specific of some sites, not found sources
Dictionaries
dictionaries for spell checker
FontLookupTableCache
- I’ll edit it soon, it looks like it’s
GPUCache
cache used by the program for GPU use
Local Storage
for use of the API localStorage
Session Storage
for use of the sessionStorage API
Network Persistent State
probably to keep the persistence settings for HTTP requests
Preferences
all preferences configured from browser/program
Summing up is only for control of own embedded browser, you yourself will not use them fully, will only use "indirectly"
These are folders of Electron do not recommend removing.
– Maury Developer
@Anittadeveloper I know it’s the Electron folders, but I want to know how I can make them not be created in the directory where I store the data? The directory I use to store the data is not the same where I run the Electron application. Have some way to make folders be created in another location?
– JeanExtreme002
I think this is not necessary, because there would be conflict of Electron finds the files.
– Maury Developer
@Anittadeveloper I really need this folder cleaned only with the files I create myself. Please help me with a solution to solve this problem.
– JeanExtreme002
I don’t recommend erasing them.
– Maury Developer
@Anittadeveloper I don’t want to delete, I just want them to go somewhere other than my folder with the data I want, got it?
– JeanExtreme002
Edited response with details on how to change the location of Chromium folders.
– Guilherme Nascimento