fast-glob
3.3.3 · 5 Jan 2025MIT203.4M / weekRepositoryHomepagenpmAtom feed
40 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 3.x · latest line
3.3.2
6 Nov 2023Handle square brackets as a special character on Windows in escape functions
Keep escaping after brace expansion
3.3.1
22 Jul 2023This release fixes a regression for cases where the
ignoreoption is used with a string (#403, #404).Full Changelog: 3.3.0...3.3.1
This release fixes a regression for cases where the
ignoreoption is used with a string (#403, #404).The public interface of this package does not support a string as the value for the
ignoreoption since 2018 year (release).So, in the next major release, we will reintroduce method implementations that do not involve strings in the
ignoreoption.3.3.0
30 Jun 2023In the past, we mishandled patterns that contained slashes when the
baseNameMatchoption was enabled, which went against the documented behavior.All negative patterns will now have the
dotoption enabled when matching paths. Previously, the!**/*patterns did not exclude hidden files (start with a dot).
Full Changelog: 3.2.12...3.3.0
Improvements
Method aliases
New methods (
glob,globSync,globStream) have been added in addition to the current methods (default import,sync,stream), which eliminate the need to rename the method when importing. In addition, anasyncalias has been added for the default import, which makes it possible to use this packet with ESM.Method to convert paths to globs
A new method (
convertPathToPattern) has been added in this release to convert a path to a pattern. The primary goal is to enable users to avoid processing Windows paths in each location where this package is used by utilities from third-party packages.See more details in the pull request.
Bug fixes
In the past, we mishandled patterns that contained slashes when the
baseNameMatchoption was enabled, which went against the documented behavior.Several problems with matching patterns that contain brace expansion have been resolved. The primary issue solved is when the pattern has duplicate slashes after it is expanded (#394), or the
micromatchpackage does not correctly generate a regular expression (#365).All negative patterns will now have the
dotoption enabled when matching paths. Previously, the!**/*patterns did not exclude hidden files (start with a dot).The issue that led to duplicates in the results when overlapping or duplicate patterns were present among the patterns has been fixed. At the moment, we are only talking about leading dot. Other cases are not included. For example, running with the patterns
['./file.md', 'file.md', '*']will now only includefile.mdonce in the results.
Documentation
A clarifying note has been added for the
concurrencyoption, which provides more detailed information about the Thread Pool utilization.3.2.12
9 Sep 2022Fixed an issue introduced in
3.2.7related to incorrect application of patterns to entries with a trailing slash when the entry is not a directory.Full Changelog: 3.2.11...3.2.12
Bug fixes
Fixed an issue introduced in
3.2.7related to incorrect application of patterns to entries with a trailing slash when the entry is not a directory.Before changes:
fg.sync('**/!(*.md)') // ['file.md', 'a/file.md', 'a/file.txt']After fix:
fg.sync('**/!(*.md)') // ['a/file.txt']Thanks @AgentEnder for the issue (#357).
Improvements
This release includes performance improvements for the asynchronous method. For this method we now use an asynchronous directory traversal interface instead of using a streaming interface. This gives up to 15% acceleration for medium and large directories. The result depends a lot on hardware.
You can find the benchmark results for this release in CI here.
Here are a few of measurements on my laptop:
===> Benchmark pattern "*" with 100 launches (regression, async) ===> Max stdev: 7 | Retries: 3 | Options: {} Name Time, ms Time stdev, % Memory, MB Memory stdev, % Entries Errors Retries --------------------- -------- ------------- ---------- --------------- ------- ------ ------- fast-glob-current.js 4.390 0.252 6.253 0.015 4 0 1 fast-glob-previous.js 5.653 0.633 6.051 0.056 4 0 1 ===> Benchmark pattern "**" with 100 launches (regression, async) ===> Max stdev: 7 | Retries: 3 | Options: {} Name Time, ms Time stdev, % Memory, MB Memory stdev, % Entries Errors Retries --------------------- -------- ------------- ---------- --------------- ------- ------ ------- fast-glob-current.js 34.587 1.287 10.654 0.607 11835 0 1 fast-glob-previous.js 41.972 2.086 10.236 1.224 11835 0 13.2.11
14 Jan 2022Yeap, this is another release aimed at fixing problems with detecting brace expansions in patterns. This time, patterns like
abc/{a.txt,b.js}was not marked as a dynamic pattern. So, now the regex has been rewritten to a generalized solution as a function to avoid future problems due to the complexity of the regular expression.Full Changelog: 3.2.10...3.2.11
Bug fixes
Yeap, this is another release aimed at fixing problems with detecting brace expansions in patterns. This time, patterns like
abc/{a.txt,b.js}was not marked as a dynamic pattern. So, now the regex has been rewritten to a generalized solution as a function to avoid future problems due to the complexity of the regular expression.3.2.10
9 Jan 2022Fixed a regression in
3.2.8when the{a,b,c}pattern no longer considered a dynamic pattern (thanks @amitdahan, #347).
3.2.8
7 Jan 2022Previously the
src/*/pattern did not work as expected (likesrc/*).Full Changelog: 3.2.7...3.2.8
Bug fixes
Fix directory matching with trailing slashes (#290)
Thanks @Trott for investigating the problem and the detailed description.
Previously the
src/*/pattern did not work as expected (likesrc/*).Double-slash in the middle of the pattern is not collapsed (#330)
Starting from this release, patterns like
src//*will work like similar patterns without duplicate slashes. This was done for continuity with other solutions (glob,ls src//*, python, golang, …).Adjust inefficient regular expressions (#336, #342, #344)
Thanks @Trott for fixing bugs and @XhmikosR for adding the CodeQL action to CI pipeline.
3.2.7
8 Jul 2021The previous release (
3.2.6) introduced a regression, which makes negative patterns were not applied to patterns outside the current directory.Bug fixes
The previous release (
3.2.6) introduced a regression, which makes negative patterns were not applied to patterns outside the current directory.This release fixes the issue.
3.2.6
27 Jun 2021- security
The
glob-parentpackage has been updated to fix vulnerabilities.
Bug fixes
// Patterns inside current directory → ['*', './*.js'] // Patterns outside current directory → ['../*', './../*.js'] // Previously you could specify a patterns outside current directory. fg.sync(['../*.txt']) → ['../file.txt'] // But when the pattern inside current directory was added to them, the behavior broke down. fg.sync(['*.md', '../*.txt']) → ['file.md'] // The '../file.txt' file exists // After this fix you can mix both kinds of patterns. fg.sync(['*.md', '../*.txt']) → ['file.md', '../file.txt'] // Right now we do not support patterns like '{.,..}/*.md'.Infrastructure
- security
The
glob-parentpackage has been updated to fix vulnerabilities.
3.2.5
17 Jan 20213.2.4
16 Jun 2020Fixed a regression in
3.2.3when thecaseSensitiveMatchoption is disabled
3.2.3
15 Jun 2020Fixed an issue when the
uniqueoption led to incorrect results when mixing static and dynamic patternsFixed an issue when the pattern starting with a forward slash
3.2.2
21 Feb 2020Fix a problem with patterns with leading dot segment (like
./…or.\\…)
3.2.0
15 Feb 2020An empty pattern now causes an error
:speech_balloon: Common
An empty pattern now causes an error
:rocket: Improvements
In the #156 issue we've redesigned the deep filter, which controls the reading of directories in depth.
Previously, this filter did not use positive patterns directly (only their maximum depth). The example below shows how many extra directories we read:
{src,fixtures}/** src → read fixtures → read out → read node_modules → readNow we apply positive patterns.
{src,fixtures}/** src → read fixtures → read out → skip node_modules → skipSynthetic benchmark
More benchmarks can be found here.
{fixtures,out}/{first,second}/*| | sync, ms | async, ms | stream, ms |
|------- |---------- |----------- |------------ |
| 3.x.x | 13 | 22 | 20 |
| 3.2.0 | 5 | 9 | 8 |{fixtures,out}/**| | sync, ms | async, ms | stream, ms |
|------- |---------- |----------- |------------ |
| 3.x.x | 37 | 49 | 52 |
| 3.2.0 | 6 | 10 | 12 |Real world benchmark
Known issues
For some cases, there is a noticeable slowdown of 3-6%.
Patterns containing
{a..z}(or similar) may introduce some slowdown.Actually,
fast-globis 2 times slower thannode-globin this scenario.
We will work on this in the future.
:tada: Thanks
@jonschlinkert for the
scanmethod inpicomatchthat returns parts of the pattern.@fisker for early beta feedback.
3.1.1
1 Dec 2019Previously, we read directories in the stream, even after the receiver is closed. Now we stop reading after closing the receiver by
.emit('end'),.destroy()orfor await...of.Bug fixes
Stream is not closed when the receiver is closed (#239)
Previously, we read directories in the stream, even after the receiver is closed. Now we stop reading after closing the receiver by
.emit('end'),.destroy()orfor await...of.const fg = require('fast-glob'); (async () => { const stream = fg.stream('**'); for await (const entry of stream) { console.log(entry); return; } })();Most likely, in future releases, we will improve integration with streams (#243).
3.1.0
6 Oct 2019New method
isDynamicPatternas an alternative toglob.hasMagicNew method
escapePathfor escaping parts of the paths of the patternMatching specific file is not found when pattern contains parentheses
Common
New method
isDynamicPatternas an alternative toglob.hasMagicNew method
escapePathfor escaping parts of the paths of the pattern
Bug Fixes
Matching specific file is not found when pattern contains parentheses
⚠️ Now we route patterns with escape symbol to dynamic patterns
Match subdirectories starting with
.in{dot: false}mode
:gear: Infrastructure
Move from TSLint to ESLint
3.0.3
27 Jun 2019Correct method for the Stream API in the documentation (#217, thanks @bluelovers)
We have divided the benchmark into two types:
We added a launch of both types of benchmark in CI. Automatically starts only when the master branch is built.
Correct method for the Stream API in the documentation (#217, thanks @bluelovers)
We have divided the benchmark into two types:
The product benchmark is a comparison of performance relative to competitors.
The regression benchmark is a comparison of performance relative to the previous version.
We added a launch of both types of benchmark in CI. Automatically starts only when the master branch is built.
Now the smoke tests are run for all API's (sync, async, stream).
Bug fixes
Non-existing directories in the globbing pattern throw an error with the asynchronous API
The
markDirectoriesoption adds extra slashes for every directory in the path with the asynchronous API
3.0.2
23 Jun 2019Entries:
4 000 000Before:
4.1GBof RAM (37s)After:
0.8GBof RAM (25s)
The
fast-glob3.0.0was released with one known bug. This release fixes it.Bug fixes
High memory usage for very big directories (#204)
Highlights
Entries:
4 000 000Before:
4.1GBof RAM (37s)After:
0.8GBof RAM (25s)
Explanation
In short, we called 2x
replaceandstartsWithon every entry. Together, that's 12 million calls.3.0.0
16 Jun 2019- breaking
Support for the
fast-glob@2is ending. - breaking
Require Node.js 8+. But we recommend using 10.10+ for performance issues.
- breaking
Only forward-slashes in glob expression. Previously, we convert all slashes to the forward-slashes, which did not allow the use of escaping. See pattern syntax section in the
README.mdfile.
Summary
This release aims to fix architectural issues, increase performance and reduce size of package.
Breaking changes
Since this is a major release, we are introducing a few breaking changes:
- breaking
Support for the
fast-glob@2is ending. - breaking
Require Node.js 8+. But we recommend using 10.10+ for performance issues.
- breaking
Only forward-slashes in glob expression. Previously, we convert all slashes to the forward-slashes, which did not allow the use of escaping. See pattern syntax section in the
README.mdfile. - breaking
Removed options:
nobrace,noglobstar,noext,nocase,transform. - breaking
Renamed options:
extension→extglobfollowSymlinkedDirectories→followSymbolicLinkscase→caseSensitiveMatchbrace→braceExpansionmatchBase→baseNameMatch
- breaking
The
deepoption now accepts onlynumbertype and default value now isInfinityinstead oftrue. - breaking
The
asyncmethod was removed. Usefg(/* … */)instead. - breaking
The type of returned object when the
statsoption is enabled is completely changed.
:bug: Bug fixes
After update from
micromatch@3tomicromatch@4:Now we do not convert slashes in patterns (#173).
Previously, the
baseNameMatchoption never worked (#199).
:rocket: Improvements
:speech_balloon: Common
Package size after installation is decreased:
2.47MB→0.42MB.Package
requiretime decreased:534ms→78ms.
:tornado: Speed
Wow! The new version is very fast. At least twice as fast as the previous version. Probably this is the fastest solution in the Node.js world. And that's not all! We will work on performance issues in the future 🐢.
Speed up between versions for directory with 265k entries: 5x (19s → 4s).
Speed up between versions for directory with 4kk entries: 4x (4m → 1m).
Look at the benchmarks section in the
README.mdfile.:gear: Flexibility
Also in this release we have worked on simplifying some scenarios.
Now, thanks to the new mechanism, you can get the type of entry without additional costs! Works only on Node.js 10.10+. Look at the
objectModeoption.Known issues in this update
- 2.x
2.2.7
18 May 2019If the user has passed a
.or..and theabsoluteoption is enabled, the paths of the found entries were not absolute (they contained.or `..).Another release of bug fixes
Bug Fixes
Paths not resolved in some cases (#157)
Thanks @stevenvachon for issue reporting :tada:
If the user has passed a
.or..and theabsoluteoption is enabled, the paths of the found entries were not absolute (they contained.or `..).before
fg.sync('/project/temp/../*.js', { absolute: true }); // → ['/project/temp/../something.js']after
fg.sync('/project/temp/../*.js', { absolute: true }); // → ['/project/something.js']The
caseoption not work with static patterns (#172)Thanks @davidmerfield for issue reporting :tada:
For performance reasons with
fast-glob@2.1.0we introducestatic patterns(patterns without glob magic).Unfortunately, then we forgot about supporting the
case(nocase) option. Now thecaseoption works fine with static patterns too. We also improved the documentation for this option.directory/ - file.txt - File.txt
before
fg.sync('file.txt', { case: false }) // → ['file.txt']after
fg.sync('file.txt', { case: false }) // → ['file.txt', 'File.txt']Question mark is not recognized as dynamic glob and fails to find files (#174)
Thanks @vladshcherbin for issue reporting and contributing :tada:
This is also related to
static patterns.Previously we mark patterns like
assets/?ss.csstostaticand tried to find such file on file system. Now it will works fine.before
fg.sync('assets/?ss.css'); // → []after
fg.sync('assets/?ss.css'); // → ['asserts/css.css']2.2.5
7 Jan 2019This package is able to build tasks on the basis of passed patterns for their parallel execution. In some cases there may be multiple. In the Stream API, each task produces its own Node.js Stream. Once the streams are created, we combine them into a single stream using the merge2 package.
Bug Fixes
Broken Stream API when errors occur
Thanks @felixbecker for issue reporting :tada:
This package is able to build tasks on the basis of passed patterns for their parallel execution. In some cases there may be multiple. In the Stream API, each task produces its own Node.js Stream. Once the streams are created, we combine them into a single stream using the merge2 package.
Before this fix, if an error occurs anywhere inside one of streams, it did not propagate to the combined stream, causing an unhandled exception.
For example, when a directory is deleted while it is being globbed with the stream API…
After this fix, all errors will be propagated to the combined stream. One exception is
ENOENTerrors – they will be ignored in all streams.2.2.4
11 Nov 2018Unfortunately, not everyone uses TypeScript.
Now we are clearly saying that we only accept strings as input.A big release of bug fixes
Common
Input values validation (#119)
Unfortunately, not everyone uses TypeScript.
Now we are clearly saying that we only accept strings as input.Bug Fixes
Absolute negative patterns (#113)
Now we support the absolute negative patterns. You can read more about this in the documentation.
📖 Works only when the
absoluteoption is enabled.Performance optimizations for non-deep patterns (#120)
We fixed a bug in the mechanism of determining the minimum required depth for reading.
📖 In some cases, we will still read more than we need to, because in the current implementation we cannot accurately determine the depth of the read. But we will work on this further within #53.
For example, the user wrote the following pattern:
fixtures/*.Prior to release of this version, FastGlob could read more directories than it needed:
./fixtures └── one 👍 └── two 👍 └── three 👍 └── four ❌ └── index.jsRight now:
./fixtures └── one ❌ └── two └── three └── four └── index.jsThe
markDirectoriesoptions does not work when theabsoluteoption is enabled(#121)Now it works correctly. Thanks @rijnhard for fix it 🎉
The
deepoptions works incorrectly (#129)Fixed the problem of incorrect depth reading limit when using the
deepoption.2.2.3
2 Oct 2018Prior to this fix, not all negative patterns could be applied to tasks. For example:
Bug Fixes
Fix incorrect grouping of negative patterns to tasks (#118)
Thanks @DudaGod for fix it 🎉
Prior to this fix, not all negative patterns could be applied to tasks. For example:
fg('fixtures/first/**/*.md', {ignore: ['fixtures/**/*.md']}).then(console.log);Give a task:
{ base: 'fixtures/first', dynamic: true, patterns: [ 'fixtures/first/**/*.md' ], positive: [ 'fixtures/first/**/*.md' ], negative: [] } // Here must be a negative pattern2.2.2
15 May 2018Now the
fast-globpackage officially supports Node.js 10.
Common
Now the
fast-globpackage officially supports Node.js 10.
Flexibility
@nodelib packages
We started migrating to @nodelib packages, which will allow us to fully control the process of package development and some performance improvements (for example, see
@nodelib/scandirwhere we can filter entries before we getfs.Stats) (#104)Bug Fixes
Fix incorrect search in negative patterns group (#107)
Previously, we skipped negative patterns whose base paths did not fully matched with the base path of the positive pattern. For more details about this situation take a look at #107.
Fix Incorrect negative pattern detection (#101)
In some cases, the
!symbol may not mean that we are working with a negative pattern.The
!(a|b|c)pattern is matches anything except one of the given patterns.2.2.0
11 Mar 20182.1.0
25 Feb 2018Speed
Now all patterns are divided into two types:
static
The patterns without glob magic.
For example:
package.json,/dev/fd, etc.dynamic
The patterns with glob magic detected by
is-glob.For example:
*.json,**/*.js, etc.This made it possible to reduce the processing time of static patterns. Something like 10-15 times. For more details, see the issue #60. Thanks @pvdlg for reporting.
Bug Fixes
Flexibility
New options that allow you not to break your brain. User-friendly alternatives for double-negative options:
⚠️ These options have more weight than their ancestors (
no*).:exclamation: In the next major release, we want to remove the options with double-negation.
2.0.3
12 Feb 2018Fix problem when
onlyFiles&onlyDirectoriesoptions is enabled in the one timeNow we can excluding from reading directories that apply to negative patterns that ends with
/**(slash and globstar) (#45).
Bug Fixes
Fix problem when
onlyFiles&onlyDirectoriesoptions is enabled in the one time
Speed
Now we are faster. Almost.
Now we can excluding from reading directories that apply to negative patterns that ends with
/**(slash and globstar) (#45).
2.0.1
21 Jan 2018Allow to export
Optionsinterface if you are using TypeScript.Now we use the
@types/readdir-enhancedpackage instead of your own types.
This is a maintenance patch release that includes following changes:
Allow to export
Optionsinterface if you are using TypeScript.Now we use the
@types/readdir-enhancedpackage instead of your own types.
Some magic for benchmarks 🎉
Please, read 2.0.0 announcement.
2.0.0
21 Jan 2018- breaking
Now we only work with array of strings in the
ignoreoption. See more details here: options#ignore. - breaking
The
onlyDirsoption has been renamed toonlyDirectories. See more details here: options#onlyDirectories. - breaking
The
onlyFilesoption is now enabled by default. See more details here: options#onlyFiles.
Faster. Stable. Flexible. Modern.
:bomb: Breaking Changes
The new version has some fundamental differences.
Drop
bashNativemodeIn the previous version we used the
bash-globpackage that provided a wrapper for thelscommand to Node.js world. Unfortunately, this package had a lot of problems with shell customizations and macOS. So, in the new version of thefast-globpackage we refused to use this package.Other
- breaking
Now we only work with array of strings in the
ignoreoption. See more details here: options#ignore. - breaking
The
onlyDirsoption has been renamed toonlyDirectories. See more details here: options#onlyDirectories. - breaking
The
onlyFilesoption is now enabled by default. See more details here: options#onlyFiles.
:rocket: Speed
Now we are faster.
Exclude directories
Now you can say goodbye to your
node_modulesdirectory. Please read «How to exclude directory from reading?» section in the documentation.Smart directory reading
Now we read in depth only those directories that must be read. For example, we have the following pattern:
src/{images,icons}/*/_*.pngIn the previous version we read all directories inside the
srcdirectory. Now we will read only two directories (imagesandicons) and one level of directories each of these directories.src/ ├── images/ ← # read │ ├── file.png │ └── nested/ ← # read │ ├── file.png │ └── wow/ ← # not read └── icons/ ← # read ├── file.png └── nested/ ← # read └── file.pngMore speed optimizations
Now we use the
micromatchas a package for the generation of regular expressions. Why? Because the package has intelligent caching, which slows the search for already prepared the regular expressions in the cache. Something around 15ms for 1000 occurrences.
:traffic_light: Stability
We just became more stable by fixing a few bugs.
:hammer: Flexibility
More options to compare with
node-globOther
Support to
ReadableStreamadapter.
- 1.x
1.0.1
3 Jun 2017Fix abolute path issues and
ENOENTerror when there are no matches (Thanks @alan-agius4 – #10)
1.0.0
28 Dec 2016Initial release.