I have a js file that contains multiple functions inside it, that can be exported to other js files and then I do some tasks. but the issue is there are some functions that take so much time like there is a function that renames thousands of files on a file system that totally blocks the electron UI for 30 seconds. here is how my file looks like:
const someModules = require("some-nodejs-modules");
function async first_CpuIntensive_Func(){
//some cpu intensive tasks
//some regexps
return someData;
}
function async second_CpuIntensive_Func(){
//some cpu intensive tasks
//some regexps
return someData;
}
module.exports = {first_CpuIntensive_Func,second_CpuIntensive_Func}
I am new to nodejs worker threads need help. Or is there any solution besides worker threads?