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

A FileSystemDirectoryHandle.

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

No specification found

No specification data found for api.Window.showDirectoryPicker.
Check for problems with this page or contribute a missing spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser compatibility

BCD tables only load in the browser

See also