How to show a file explorer window in electron app, where the user can select a particular folder?

1.7k Views Asked by At

I want to pop open a file explorer window in Electron app using React and have a user select a particular folder and then capture the filepath they select, for further processing.

Is there a way to implement the above requirement and any leads would be really helpful .

1

There are 1 best solutions below

0
On

Using electron dialogs, file explorer can be added in electron app.

const fs = require("fs");
const {dialog} = window.require("electron").remote;

dialog.showOpenDialogSync({
properties: [
          'openFile', 
          'openDirectory']
      })

Some useful resources: