FileSystemDirectoryHandle: resolve() method
The resolve()
method of the FileSystemDirectoryHandle
interface returns an Array
of directory names from the parent handle to the specified child entry, with the name of the child entry as the last array item.
Syntax
resolve(possibleDescendant)
Parameters
-
possibleDescendant
-
The FileSystemHandle
from which to return the relative path.
Return value
A Promise
which resolves with an Array
of strings, or null
if possibleDescendant
is not a descendant of this FileSystemDirectoryHandle
.
Exceptions
No exceptions are thrown.
Examples
The following asynchronous function uses resolve()
to find the path to a chosen file, relative to a specified directory handle.
async function returnPathDirectories(directoryHandle) {
const [handle] = await self.showOpenFilePicker();
if (!handle) {
return;
}
const relativePaths = await directoryHandle.resolve(handle);
if (relativePaths === null) {
} else {
for (const name of relativePaths) {
console.log(name);
}
}
}
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
resolve |
86 |
86 |
111 |
No |
72 |
15.2 |
No |
86 |
111 |
61 |
15.2 |
14.0 |
See also