thecodrr / fdir

âš¡ The fastest directory crawler & globbing library for NodeJS. Crawls 1m files in < 1s
https://thecodrr.github.io/fdir/
MIT License
1.51k stars 58 forks source link

Getting only directories #43

Closed bbugh closed 3 years ago

bbugh commented 4 years ago

Hi! 👋 I'm shopping around for a fast npm globber to use in a visual studio code extension. The other npm libraries are still too slow for our very large project.

This extension needs only directories, not files. I see the withDirs function, but capturing files seems deep in the shared code:

https://github.com/thecodrr/fdir/blob/master/src/api/shared.js#L43-L44

How hard would it be to make an "onlyDirs()" builder or something? Is this something you think would be a good addition? I didn't see anything in filter either that would allow this to work.

Thanks!

thecodrr commented 4 years ago

Hey, thank you for considering fdir.

Adding onlyDirs shouldn't be too hard. Just a flag that we'll need to check. It should be slightly faster as well since array.push is called not as frequently.

I will look into it, it seems like a good feature.