FileSystemHandle.name

Baseline 2023
Newly available

Since March 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

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

FileSystemHandle インターフェイスの読み取り専用プロパティ name は、ハンドルが表すエントリーの名前を返します。

文字列です。

以下の関数は、ユーザーにファイルピッカーでファイルを選択させ、name プロパティを取得します。

js
// ファイルハンドルへの参照を保存する
let fileHandle;

async function getFile() {
  // ファイルピッカーを開く
  [fileHandle] = await window.showOpenFilePicker();

  const fileName = fileHandle.name;
}

仕様書

Specification
File System
# ref-for-dom-filesystemhandle-name①

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
name

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

関連情報