FileSystemHandle:isSameEntry() 方法

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

安全上下文: 此项功能仅在一些支持的浏览器安全上下文(HTTPS)中可用。

FileSystemHandle 接口的 isSameEntry() 方法用于比对两个句柄以查看两者关联的条目(文件或目录)是否相符。

语法

js
isSameEntry(fileSystemHandle)

参数

FileSystemHandle

需要与调用此方法的句柄进行匹配的 FileSystemHandle

返回值

返回一个 Boolean 值,如果条目相符则此值为 true

异常

不抛出异常。

示例

以下函数将单个条目与条目数组进行比对,返回包含不相符条目的新数组。

js
function removeMatches(fileEntry, entriesArr) {
  let newArr = entriesArr.filter((entry) => !fileEntry.isSameEntry(entry));

  return newArr;
}

规范

Specification
File System Standard
# api-filesystemhandle-issameentry

浏览器兼容性

BCD tables only load in the browser

参见