FileSystemHandle: isSameEntry() method
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2023.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
Phương thức isSameEntry() của giao diện FileSystemHandle so sánh hai handle để xem liệu các mục liên quan (tệp hoặc thư mục) có khớp hay không.
Cú pháp
js
isSameEntry(fileSystemHandle)
Tham số
FileSystemHandle-
FileSystemHandleđể so sánh với handle mà phương thức được gọi trên đó.
Giá trị trả về
Một Promise được giải quyết với giá trị Boolean.
Ví dụ
Hàm sau đây so sánh một mục duy nhất với một mảng các mục và trả về Promise được thực hiện với mảng mới đã loại bỏ các mục khớp.
js
async function removeMatches(fileEntry, entriesArr) {
const newArr = [];
for (const entry of entriesArr) {
if (!(await fileEntry.isSameEntry(entry))) {
newArr.push(entry);
}
}
return newArr;
}
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| File System> # api-filesystemhandle-issameentry> |