I'm trying to check if a file exist and if not, starts to download in my eletron app.
The error i have is the next one :
error - ./node_modules/electron/index.js:1:0
Module not found:can't resolve 'fs'
null
Where i use the function
mainWindow.webContents.session.on(
'will-download',
.....
ipcMain.on('folder', (event, arg) => {
if (arg === 'check') {
const folder =
app.getPath('userData') +
'\\Local Storage\\' +
privateHash.split('.')[0];
var file = searchFile(folder);
if (file != null) {
OpenApp(
folder + '\\' + file,
meeting,
token,
company,
avatar,
scene
);
} else {
sending a message to the renderer to download the file
}
The searchFile function is something like this :
const searchFile = (folder) => {
var fs = require('fs');
var files = fs.readdirSync(folder.split('.')[0]);
....
I have looked in stackOverflow to similar problems and try their solutions, but for me it doesn't work.If somebody can help it will be great. I put nodeIntegration, in package.json browser..fs:false,path:false,os:false..,i add to next.config.js webpack config , nothing is working for me