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

Read folder #75

Open
MohrJonas opened this issue Aug 1, 2023 · 4 comments
Open

Read folder #75

MohrJonas opened this issue Aug 1, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@MohrJonas
Copy link

Hi there,
I really enjoy using your file picker.
Would it be possible to add the ability to select folders and get their respective content?
Thank you.

@MrKampla
Copy link
Collaborator

MrKampla commented Aug 1, 2023

Hi @MohrJonas,
happy to hear that you like our package!

Would it be possible to add the ability to select folders and get their respective content?

Yes, it's on our roadmap. We already have an idea how to implement this, as we did research around browser APIs for directory pickers some time ago.
Unfortunately, I don't have any estimates regarding the release date of such a feature. Right now, we're focusing on delivering v2.0.0 of use-file-picker that significantly improves DX and fixes some bugs. But right after that, we can dive into the select folders feature. I'll make sure to mention this issue in the PR that introduces the select folders feature, so you get a notification when it happens.

@MohrJonas
Copy link
Author

Amazing to hear.
Thank you very much

@Jaaneek Jaaneek added the enhancement New feature or request label Oct 12, 2023
@ReallyLiri
Copy link

Hi @MohrJonas, happy to hear that you like our package!

Would it be possible to add the ability to select folders and get their respective content?

Yes, it's on our roadmap. We already have an idea how to implement this, as we did research around browser APIs for directory pickers some time ago. Unfortunately, I don't have any estimates regarding the release date of such a feature. Right now, we're focusing on delivering v2.0.0 of use-file-picker that significantly improves DX and fixes some bugs. But right after that, we can dive into the select folders feature. I'll make sure to mention this issue in the PR that introduces the select folders feature, so you get a notification when it happens.

Can you share some hints about how you thought to achieve this functionality?
From playing around with the options, it doesn't seem like a built-in browser picker can allow selection of both files and folders.
Unless we are only talking about folder picking.
ref https://stackoverflow.com/a/16774922/1236401 , which is old, but seems no updates since (?)

@MrKampla
Copy link
Collaborator

MrKampla commented Feb 6, 2024

@ReallyLiri
You're right, there's no built-in browser picker that allows for selection of both files and folders, so we're only talking about directory picking.
To shed some light on the actual implementation, we were thinking about creating a new hook exported from our package called useDirectoryPicker. It would be based on a part of this library browser-fs-access which is a ponyfill for File System API. The most popular browsers have support for directory picking with fs api since 2021 (Safari was last to implement it). It also falls back to the legacy webkitdirectory property on a plain input element that you've linked, if the user's browser does not support the new fs api.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants