showOpenDialog
Resolve with an object containing the following:
canceled
boolean - whether or not the dialog was canceled.filePaths
string[] - An array of file paths chosen by the user. If the dialog is cancelled this will be an empty array.bookmarks
string[] (optional) macOS mas - An array matching thefilePaths
array of base64 encoded strings which contains security scoped bookmark data.securityScopedBookmarks
must be enabled for this to be populated. (For return values, see table here.)
The browserWindow
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 properties
to ['openFile', 'openDirectory']
on these platforms, a directory selector will be shown.