A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://developer.mozilla.org/ja/docs/Web/API/FileSystemDirectoryHandle/resolve below:

FileSystemDirectoryHandle.resolve() - Web API | MDN

FileSystemDirectoryHandle.resolve()

Baseline 2023

Newly available

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

FileSystemDirectoryHandle インターフェイスの resolve() メソッドは、親ハンドルから指定の子エントリーへのディレクトリー名の Array を返します。指定された子エントリーが配列の最後の要素になります。

構文
resolve(possibleDescendant)
引数 返値

文字列の Array、または possibleDescendant がこの FileSystemDirectoryHandle の子孫でないときは null で解決する Promise を返します。

例外

例外は投げられません。

例

以下の非同期関数は、resolve() を用いて、選択されたファイルの指定のディレクトリーハンドルを基準とする相対パスを取得します。

async function returnPathDirectories(directoryHandle) {
  // ファイルピッカーを開き、ファイルハンドルを得る
  const [handle] = await self.showOpenFilePicker();
  if (!handle) {
    // ユーザーがキャンセルしたか、ファイルを開くのに失敗した
    return;
  }

  // ハンドルがディレクトリーハンドル内に存在するかを確認する
  const relativePaths = await directoryHandle.resolve(handle);

  if (relativePaths === null) {
    // ディレクトリーハンドル内に存在しない
  } else {
    // relativePath は相対パスを表す名前の配列
    for (const name of relativePaths) {
      // 各エントリーを記録する
      console.log(name);
    }
  }
}
仕様書 ブラウザーの互換性 関連情報

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4