How to effectively read files and directories inside a shared network drive using nodejs/electronjs without blocking the main and renderer process?

I am working on a windows electronjs/react app that heavily deals with filesystem. Like creating files, reading, traversing a path recursively that might include tens of dub-directories and files.

To be more concise, the above functionalities working good when i am dealing with a local file system. But when the app has to work against a filesystem inside a shared network drive like (connecting to a remote server using windows remote desktop connection) then performing the above mentioned actions block the renderer process. I have tried using worker threads and electron hidden BrowserWindow as a independant process to carry out the required functions specially the “traversing a path recursively that might include tens of dub-directories and files.”

I am using async versions of every filesystem API and electron IPC API.
I am using ipcRenderer.invoke and ipcMain.handle to communicate in b/w the two processes.

This same shared network drive, when opened with vscode shows the loading indicator for the file explorer menu but does not make vscode to lag and crash.

I am wondering what i am doing wrong here is it the algorithm or should i need to learn something that i am missing?

The algorithm used to traverse filesystem tree inside a shared network drive/folder:

/**
 * This function recursively iterates over a path to load all of the content from the 
 * current path and subdirectories.
 * @param {string} path - Path to load content from.
 * @param {boolean} [isNestedPath=false] - Flag to indicate if the path is nested.
 * @returns {Promise<[{path: string, name: string, type: "file"|"folder", children: []| undefined}]>}
 */
const loadAvailableDocumentsRecursively = async (path, isNestedPath = false) => {
  const isADirPath = await isDir(path);
  
  if (!isADirPath) {
    throw new Error("path argument must be a directory");
  }

  const contentsAtPath = await jetpack.listAsync(path);
  
  // Use Promise.all to load all directory contents in parallel
  const resultPromises = contentsAtPath.map(async (content) => {
    const nestedPath = jetpack.path(path, content);
    const isDirectory = await isDir(nestedPath);

    if (isDirectory) {
      return {
        name: content,
        type: 'folder',
        path: nestedPath,
        isNestedPath,
        children: await loadAvailableDocumentsRecursively(nestedPath, true)
      };
    } else {
      return {
        name: content,
        type: 'file',
        path: nestedPath,
        isNestedPath
      };
    }
  });

  // Resolve all promises and return the result
  return Promise.all(resultPromises);
};

I have also done my research across stakeoverflow but it did not help!

I have tried implementing worker threads and electron hidden BrowserWindow as an independed renderer process to carry out the required operation but no luck.

The mentioned filesystem operations when applied on a network shared drive/folder should not block the UI and main process.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật