Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2023年3月.
安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。
File System Access API の FileSystemDirectoryHandle インターフェイスは、ファイルシステムのディレクトリーへのハンドルを提供します。
このインターフェイスは、メソッド window.showDirectoryPicker()・StorageManager.getDirectory()・DataTransferItem.getAsFileSystemHandle()・FileSystemDirectoryHandle.getDirectoryHandle() からアクセス可能です。
FileSystemHandle FileSystemDirectoryHandle親の FileSystemHandle からプロパティを継承します。
親の FileSystemHandle からメソッドを継承します。
FileSystemDirectoryHandle.entries()オブジェクト自身の列挙可能なプロパティの [key, value] ペアの新しい 非同期イテレーター を返します。
FileSystemDirectoryHandle.getFileHandle()メソッドが呼ばれたディレクトリー内の指定の名前のファイルを表す FileSystemFileHandle で解決する Promise を返します。
FileSystemDirectoryHandle.getDirectoryHandle()メソッドが呼ばれたディレクトリー内の指定の名前のサブディレクトリーを表す FileSystemDirectoryHandle で解決される Promise を返します。
FileSystemDirectoryHandle.keys()FileSystemDirectoryHandle 内の各アイテムのキーを含む新しい 非同期イテレーター を返します。
FileSystemDirectoryHandle.removeEntry()ディレクトリーハンドルに指定の名前のファイルまたはディレクトリーがある場合、非同期でエントリーを削除しようとします。
FileSystemDirectoryHandle.resolve()親ハンドルから指定の子エントリーへのディレクトリー名の Array (最後の要素は指定した子エントリーの名前) で解決する Promise を返します。
FileSystemDirectoryHandle.values()FileSystemDirectoryHandle 内の各インデックスに対応する値を含む新しい 非同期イテレーター を返します。
FileSystemDirectoryHandle[Symbol.asyncIterator]()デフォルトでは entries 関数を返します。
以下の例では、指定の名前のディレクトリーハンドルを返します。指定したディレクトリーが存在しない場合は、作成されます。
以下の非同期関数は、resolve() を用いて、選択されたファイルの指定のディレクトリーハンドルを基準とする相対パスを取得します。
以下の例では、ディレクトリーを再帰的に走査し、ディレクトリー内の各ファイルを表す FileSystemFileHandle オブジェクトを返します。
| File System # api-filesystemdirectoryhandle |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年3月26日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.