sindresorhus / globby

User-friendly glob matching
MIT License
2.49k stars 126 forks source link

Allow abort glob progress #261

Open otakustay opened 6 months ago

otakustay commented 6 months ago

I was racing a globby call with a 200ms timeout so that I can fallback to a default value if glob takes too long, I’d also like to abort glob progress if timeout happens to save some filesystem scan and cpu usage, how about if we can pass an AbortSignal in oprions?

Another case is to implement something like globExists which returns true on first match, this is done by using globStream function and directly return true in the for … await loop, also I’d like to abort further progress of glob

Of course it’s a best if a globExists function can be provided.

sindresorhus commented 6 months ago

Makes sense, but it will have to be implemented in https://github.com/mrmlnc/fast-glob first. Open an issue there too.