FileSystemDirectoryHandle.entries()

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。

FileSystemDirectoryHandle インターフェイスの entries() メソッドは、for...in が提供するのと同じ順序でオブジェクト自身の列挙可能なプロパティの [key, value] ペアの配列を返します。(違いは、for-in ループはプロトタイプチェーン内のプロパティも列挙することです)

構文

js
entries()

引数

なし

返値

FileSystemDirectoryHandle オブジェクト自身の列挙可能なプロパティの [key, value] ペアの配列を返します。

js
const dirHandle = await window.showDirectoryPicker();

for await (const [key, value] of dirHandle.entries()) {
  console.log({ key, value });
}

仕様書

Specification
File System Standard
# api-filesystemdirectoryhandle-asynciterable

ブラウザーの互換性

BCD tables only load in the browser

関連情報