showOpenDialog
Resolve with an object containing the following:
canceledboolean - whether or not the dialog was canceled.filePathsstring[] - An array of file paths chosen by the user. If the dialog is cancelled this will be an empty array.bookmarksstring[] (optional) macOS mas - An array matching thefilePathsarray of base64 encoded strings which contains security scoped bookmark data.securityScopedBookmarksmust be enabled for this to be populated. (For return values, see table here.)
The window argument allows the dialog to attach itself to a parent window, making it modal.
The filters specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. For example:
The extensions array should contain extensions without wildcards or dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use the '*' wildcard (no other wildcard is supported).
!NOTE On Windows and Linux an open dialog can not be both a file selector and a directory selector, so if you set
propertiesto['openFile', 'openDirectory']on these platforms, a directory selector will be shown.
!NOTE On Linux
defaultPathis not supported when using portal file chooser dialogs unless the portal backend is version 4 or higher. You can use--xdg-portal-required-versioncommand-line switch to force gtk or kde dialogs.