GoogleChromeLabs / browser-fs-access

File System Access API with legacy fallback in the browser
https://googlechromelabs.github.io/browser-fs-access/demo/
Apache License 2.0
1.38k stars 84 forks source link

Add a callback to skip the opening of a recursive directory #80

Closed Amatewasu closed 2 years ago

Amatewasu commented 2 years ago

This PR allows passing a callback to say whether we want to open this directory based on the developer criteria (such as the name for example). For example, you can skip the directory with a name beginning with a point ('.git', '.backup', etc.).

google-cla[bot] commented 2 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

tomayac commented 2 years ago

Thank you, this looks like it could go in the right direction! Can you add the same logic to the legacy fallback implementation for consistency, please?

google-cla[bot] commented 2 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

Amatewasu commented 2 years ago

Sure! What do you think of the implementation?

For the legacy fallback, it is far from being fully optimized because the browser still has to load all the files. Moreover, the callback skipDirectory will be called several times for every folder (but this computation time is negligible compared to the files load time).

tomayac commented 2 years ago

Getting there, see my remarks. Can I also ask you to run npm run fix and commit the result, please?

Amatewasu commented 2 years ago

Sure thank you for your remarks, I committed the result.

tomayac commented 2 years ago

(Sorry for the delay, I'm busy with Chrome Dev Summit and other things, but I will get back to you, promised.)

tomayac commented 2 years ago

Thank you again! This has now been published as v0.21.1.