Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convenience method for recursive directory iteration #15

Open
a-sully opened this issue Mar 8, 2022 · 8 comments
Open

Convenience method for recursive directory iteration #15

a-sully opened this issue Mar 8, 2022 · 8 comments
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest

Comments

@a-sully
Copy link
Collaborator

a-sully commented Mar 8, 2022

Migrated from WICG/file-system-access#173 (see #2)

It should be easy to read only files or subfolders from a parent folder, and have a recursive option to return the contents of subfolders. Example:

try {
 for await(let file_reference of folder_reference.read({ files: true, folders: false, recursive: true })) {
  console.log(file_reference)
 }
} catch(error) {
 console.error(error)
}
@jimmywarting
Copy link

question: How would we deal with knowing the path of some handle when going into recursive mode?

@jesup
Copy link
Contributor

jesup commented Jun 29, 2022

You could use resolve() (or whatever we rename it to, the name is ugly)

@jimmywarting
Copy link

jimmywarting commented Jun 29, 2022

ah, forgot about the resolve, yea the name is a bit weird, it don't stick and immediately tells you what the fn dose for something... think it's in conflict with the new Promise(resolve =>

how about:

  • handle.pathRelativeTo(other)
  • handle.relativeTo(other)
  • or some other...

@a-sully
Copy link
Collaborator Author

a-sully commented Jun 29, 2022

I had proposed some alternatives names in #4 (comment). Let's move the naming discussions to that issue

@mkruisselbrink
Copy link
Collaborator

If this is implemented as parameters to the asynchronous iterator initialization for a directory handle (i.e. parameters to values, keys and entries) presumably the keys returned by keys and entries could somehow return the entire path as well, avoiding the need for a separate path lookup...

@jesup
Copy link
Contributor

jesup commented Jul 1, 2022

So do we need a recursive iterator? IIRC most OS's don't provide such a thing; it's easy enough to build on top of the existing interfaces.

@jimmywarting
Copy link

I do think most terminal have a recursive mode when searching/deleting files

@jesup
Copy link
Contributor

jesup commented Jul 10, 2022

Cli commands have different requirements and reasoning for options than API calls.

@a-sully a-sully added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest labels Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest
Development

No branches or pull requests

4 participants