このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

FileSystemDirectoryHandle.entries()

Baseline Widely available

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

安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (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
# api-filesystemdirectoryhandle-asynciterable

ブラウザーの互換性

関連情報