JavaScripture
Contribute via GitHub
Feedback
FileSystemDirectoryHandle
Instance Indexers
Instance Methods
getDirectoryHandle
getFileHandle
removeEntry
resolve
FileAPI API
All API
No API set selected.
FileSystemDirectoryHandle
:
FileSystemHandle
async iterable
See
window.showDirectoryPicker
.
Spec
Instance Indexers
this
[
Symbol.asyncIterator
] :
Function
<
AsyncIterator
<
FileSystemHandle
>>
Example:
startIn: <select id="startIn"> <option>desktop</option> <option>documents</option> <option>downloads</option> <option>music</option> <option selected>pictures</option> <option>videos</option> </select><br> <button onclick="openDirectory()">Open Directory</button> <script> const openDirectory = async () => { try { const directoryHandle = await showDirectoryPicker({ startIn: document.getElementById('startIn').value, }); console.log(`${directoryHandle.name}:`); for await (const [name, fileHandle] of directoryHandle) { console.log(' ', name, fileHandle.kind); } } catch (e) { console.log(e); } }; </script>
Run
Results:
Instance Methods
getDirectoryHandle
(
name
:
String
,
[
options
:
Object
]
) :
Promise
<
FileSystemDirectoryHandle
>
options
: {
create
:
Boolean
Default =
false
.
}
Spec
getFileHandle
(
name
:
String
,
[
options
:
Object
]
) :
Promise
<
FileSystemFileHandle
>
options
: {
create
:
Boolean
Default =
false
.
}
Spec
removeEntry
(
name
:
String
,
[
options
:
Object
]
) :
Promise
<
undefined
>
options
: {
recursive
:
Boolean
Default =
false
.
}
Spec
resolve
(
possibleDescendant
:
FileSystemHandle
) :
Promise
<
Array
<
String
>>
Spec
home
license
contribute
feedback
toggle light/dark mode
Copyright © JavaScripture Contributors