FileSystemEntry: name プロパティ

nameFileSystemEntry インターフェイスの読み取り専用プロパティで、この項目の名前を指定する文字列を返します。これは、親ディレクトリー内の項目(fullPath プロパティが示すパスの最後の部品)です。

項目の名前を示す文字列。

この例では isFileWithExtension() という関数を示しています。この関数は、指定した FileSystemEntry がファイルであり、かつそのファイル名が指定された拡張子で終わっている場合に true を返します。

js
function isFileWithExtension(entry, extension) {
  return entry.isFile && entry.name.endsWith(`.${extension}`);
}

仕様書

Specification
File and Directory Entries API
# dom-filesystementry-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

関連情報