Window.showDirectoryPicker()

Draft

This page is not complete.

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 Status Comment
Unknown
The definition of 'showDirectoryPicker' in that specification.
Unknown Initial definition.

Browser compatibility

BCD tables only load in the browser

See also