Skip to content

How To List Files in a FileSystemDirectoryHandle #4054

Answered by daxpedda
cstack89 asked this question in Q&A
Discussion options

You must be logged in to vote

I believe what you are looking for is FileSystemDirectoryHandle.entries(), which is not the same as Object.entries().

Unfortunately this method is currently not available in web-sys, but it was added in #3962, so you have to wait for the new release, depend on the master branch or add bindings yourself:

extern "C" {
    #[wasm_bindgen(extends = FileSystemDirectoryHandle)] 
    type FileSystemDirectoryHandleExt;
    #[wasm_bindgen(method)]
    fn entries(this: &FileSystemDirectoryHandleExt) -> js_sys::AsyncIterator;
}

let dir: FileSystemDirectoryHandle = dir;
let dir: FileSystemDirectoryHandleExt = dir.unchecked_into();
let entries = dir.entires();

while Ok(entry) = entries.next() {
    let

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by cstack89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #4053 on August 06, 2024 11:08.