Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. FileSystemDirectoryHandle
  4. keys()

FileSystemDirectoryHandle: keys() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨March 2023⁩.

Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.

Note: This feature is available inWeb Workers.

Thekeys() method of theFileSystemDirectoryHandle interface returns a new asynchronous iteratorfor the iteration of the key of the entries within theFileSystemDirectoryHandleon which this method is called.

Syntax

js
keys()

Parameters

None.

Return value

A new asynchronous iterator containing the keys of each entry within theFileSystemDirectoryHandle.

Exceptions

NotAllowedErrorDOMException

Thrown if thePermissionStatus.state for the handle is not'granted' inread mode.

NotFoundErrorDOMException

Thrown if the current entry is not found.

Examples

Use thefor await...of loop can simplify the iteration process.

js
const dirHandle = await window.showDirectoryPicker();for await (const key of dirHandle.keys()) {  console.log(key);}

Specifications

Specification
File System
# api-filesystemdirectoryhandle-asynciterable

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp