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

Add doNotRecurseIntoDirectory option? #48

Open
KyleAMathews opened this issue Feb 2, 2017 · 8 comments
Open

Add doNotRecurseIntoDirectory option? #48

KyleAMathews opened this issue Feb 2, 2017 · 8 comments

Comments

@KyleAMathews
Copy link

It'd save some time on very big subdirectory trees if you could avoid reading subdirectories that you're going to ignore anyways e.g. node_modules. Better to just avoid reading those directories at all.

Would you be ok with a PR adding this?

@KyleAMathews
Copy link
Author

Or perhaps just ignoreDirectory.

@KyleAMathews
Copy link
Author

Ok this makes a big difference (for my use case anyways). On a Lerna monorepo with a number of packages and node_modules directories w/o ignoring node_modules, it took ~9 seconds to list files. When ignoring node_modules directories, it took 0.16 seconds.

I'll make a PR real quick!

@KyleAMathews
Copy link
Author

Hmmm... though needing to add another argument complicates things. Would you be ok if we turn the first argument into an object with named arguments?

@jergason
Copy link
Owner

jergason commented Feb 5, 2017

I like this idea. Reading every file and then just filtering them out does seem pretty inefficient.

@KyleAMathews
Copy link
Author

Sweet! How do you want to handle adding the new argument?

@jergason
Copy link
Owner

jergason commented Feb 8, 2017 via email

@Ajedi32
Copy link
Contributor

Ajedi32 commented Apr 3, 2017

FYI, pretty sure ignoring a directory already stops this module from recursing into it. See:

https://github.com/jergason/recursive-readdir/blob/v2.1.0/index.js#L47-L53

@MatthieuLemoine
Copy link

@jergason Are you still interested in this idea ?

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

No branches or pull requests

4 participants