Window.showDirectoryPicker()
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The showDirectoryPicker() method of the
Window interface displays a directory picker which allows the user to
select a directory.
Syntax
var FileSystemDirectoryHandle = window.showDirectoryPicker();
Parameters
None.
Return value
Exceptions
AbortError-
Thrown if the user dismisses the prompt without making a selection, or if the user agent deems the selected content to be too sensitive or dangerous
Examples
This asynchronous function shows a directory picker and returns a
FileSystemDirectoryHandle once selected.
async function getDir() {
const dirHandle = await window.showDirectoryPicker();
// run code for dirHandle
}
Specifications
| Specification |
|---|
| File System Access # api-showdirectorypicker |
Browser compatibility
BCD tables only load in the browser