• Home
  • Raw
  • Download

Lines Matching refs:glob

5 The most correct and second fastest glob implementation in
9 ![a fun cartoon logo made of glob characters](https://github.com/isaacs/node-glob/raw/main/logo/glo…
16 npm i glob
19 **Note** the npm package name is _not_ `node-glob` that's a
20 different thing that was abandoned years ago. Just `glob`.
24 import { glob, globSync, globStream, globStreamSync, Glob } from 'glob'
27 glob,
32 } = require('glob')
34 // the main glob() and globSync() resolve/return array of filenames
37 const jsfiles = await glob('**/*.js', { ignore: 'node_modules/**' })
39 // pass in a signal to cancel the glob walk
40 const stopAfter100ms = await glob('**/*.css', {
45 const images = await glob(['css/*.{png,jpeg}', 'public/*.{png,jpeg}'])
47 // but of course you can do that with the glob pattern also
59 // glob objects are async iterators, can also do globIterate() or
64 // pass a glob as the glob options to reuse its settings and caches
89 const results = await glob('**', { stat: true, withFileTypes: true })
101 const customIgnoreResults = await glob('**', {
110 const folderNamedModules = await glob('**/*.{ts,js}', {
121 const newFiles = await glob('**', {
139 even on Windows systems, as `\` is used to escape glob
143 special glob characters cannot be escaped, making it impossible
149 $ glob -h
152 glob [options] [<pattern> [<pattern> ...]]
154 Expand the positional glob expression arguments into any matching file system
158 Run the command provided, passing the glob expression
161 -A --all By default, the glob cli command will not expand any
165 expands an argument whose filename is a glob
169 then on Windows powershell or cmd.exe, 'glob app/*.ts'
172 expand 'app/*.ts' to a list of filenames. Then glob
176 Setting '--all' prevents this behavior, causing glob to
177 treat ALL patterns as glob expressions to be expanded,
182 them to the glob command process.
271 ## `glob(pattern: string | string[], options?: GlobOptions) => Promise<string[] | Path[]>`
273 Perform an asynchronous glob search for the pattern(s) specified.
281 Synchronous form of `glob()`.
283 Alias: `glob.sync()`
287 Return an async iterator for walking glob pattern matches.
289 Alias: `glob.iterate()`
293 Return a sync iterator for walking glob pattern matches.
295 Alias: `glob.iterate.sync()`, `glob.sync.iterate()`
302 Alias: `glob.stream()`
311 Alias: `glob.stream.sync()`, `glob.sync.stream()`
315 Returns `true` if the provided pattern contains any "magic" glob
322 contain any magic glob characters, and it's treated the same as
329 Escape all magic characters in a glob pattern, so that it will
341 Un-escape a glob string that may contain some escaped characters.
357 An object that can perform glob pattern traversals.
416 If you are running many `glob` operations, you can pass a Glob
454 containing literal glob pattern characters, but allows matching
470 glob pattern matching itself.
522 glob pattern or array of glob patterns to exclude from matches.
592 Much more information about glob pattern expansion can be found
648 character, then it will not match any glob pattern unless that
656 You can make glob treat dots as normal characters by setting
677 ## Comparisons to other fnmatch/glob implementations
680 worthwhile goal, some discrepancies exist between node-glob and
692 the like. You can force glob to traverse symlinks with `**` by
700 any other interpretation of the glob pattern. Thus, a pattern
729 **Please only use forward-slashes in glob expressions.**
732 `/` characters are used by this glob implementation. You must use
733 forward-slashes **only** in glob expressions. Back-slashes will
741 strings, **thus making it impossible to escape literal glob
774 For example, `glob('/tmp', { cwd: 'c:/any/thing' })` will return
787 As a result, it is possible that a file that exists when glob
794 cache object is reused between glob calls.
796 Users are thus advised not to use a glob result as a guarantee of
813 [here](https://github.com/isaacs/node-glob/tree/master/logo).
844 - If you want glob matching that is as faithful as possible to
848 are relatively simple, and want the absolutely fastest glob
849 matcher out there, _use [fast-glob](http://npm.im/fast-glob)_.
855 There are some other glob matcher libraries on npm, but these
865 [fast-glob](http://npm.im/fast-glob), though they differ in their
870 `fast-glob` is, as far as I am aware, the fastest glob
872 cases where the choices that `fast-glob` makes in pursuit of
876 In my testing, `fast-glob` is around 10-20% faster than this
892 Globby exhibits all of the same pattern semantics as fast-glob,
893 (as it is a wrapper around fast-glob) and is slightly slower than
894 node-glob (by about 10-20% in the benchmark test set, or in other
895 words, anywhere from 20-50% slower than fast-glob). However, it
903 performing a glob pattern expansion as faithfully as possible to
907 Note that prior versions of `node-glob` are _not_ on this list.
915 returns results and `fast-glob` doesn't, it's even faster, of
918 ![lumpy space princess saying 'oh my GLOB'](https://github.com/isaacs/node-glob/raw/main/oh-my-glob
929 node fast-glob sync 0m0.598s 200364
932 node current glob syncStream 0m0.649s 222656
934 node fast-glob async 0m0.350s 200364
936 node current glob async mjs 0m0.463s 222656
937 node current glob stream 0m0.411s 222656
941 node fast-glob sync 0m0.486s 0
944 node current glob syncStream 0m0.583s 2242
946 node fast-glob async 0m0.283s 0
948 node current glob async mjs 0m0.299s 2242
949 node current glob stream 0m0.312s 2242
953 node fast-glob sync 0m0.490s 10
956 node current glob syncStream 0m0.550s 10
958 node fast-glob async 0m0.290s 10
960 node current glob async mjs 0m0.278s 10
961 node current glob stream 0m0.302s 10
965 node fast-glob sync 0m0.500s 160
968 node current glob syncStream 0m0.573s 160
970 node fast-glob async 0m0.283s 160
972 node current glob async mjs 0m0.306s 160
973 node current glob stream 0m0.322s 160
977 node fast-glob sync 0m0.502s 5230
980 node current glob syncStream 0m0.557s 5230
982 node fast-glob async 0m0.285s 5230
984 node current glob async mjs 0m0.304s 5230
985 node current glob stream 0m0.310s 5230
989 node fast-glob sync 0m0.580s 200023
992 node current glob syncStream 0m0.649s 200023
994 node fast-glob async 0m0.349s 200023
996 node current glob async mjs 0m0.427s 200023
997 node current glob stream 0m0.388s 200023
1001 node fast-glob sync 0m0.589s 200023
1004 node current glob syncStream 0m0.684s 200023
1006 node fast-glob async 0m0.351s 200023
1008 node current glob async mjs 0m0.462s 200023
1009 node current glob stream 0m0.468s 200023
1013 node fast-glob sync 0m0.496s 1000
1016 node current glob syncStream 0m0.567s 1000
1018 node fast-glob async 0m0.285s 1000
1020 node current glob async mjs 0m0.305s 1000
1021 node current glob stream 0m0.301s 1000
1025 node fast-glob sync 0m0.484s 0
1028 node current glob syncStream 0m0.586s 4880
1030 node fast-glob async 0m0.280s 0
1032 node current glob async mjs 0m0.327s 4880
1033 node current glob stream 0m0.324s 4880
1037 node fast-glob sync 0m0.547s 100000
1040 node current glob syncStream 0m0.618s 100000
1042 node fast-glob async 0m0.315s 100000
1044 node current glob async mjs 0m0.366s 100000
1045 node current glob stream 0m0.345s 100000
1049 node fast-glob sync 0m0.588s 100000
1052 node current glob syncStream 0m0.687s 200023
1054 node fast-glob async 0m0.343s 100000
1056 node current glob async mjs 0m0.519s 200023
1057 node current glob stream 0m0.451s 200023
1061 node fast-glob sync 0m0.573s 160023
1064 node current glob syncStream 0m0.659s 180023
1066 node fast-glob async 0m0.345s 160023
1068 node current glob async mjs 0m0.427s 180023
1069 node current glob stream 0m0.388s 180023
1073 node fast-glob sync 0m0.483s 0
1076 node current glob syncStream 0m0.773s 200023
1078 node fast-glob async 0m0.280s 0
1080 node current glob async mjs 0m0.617s 200023
1081 node current glob stream 0m0.568s 200023
1085 node fast-glob sync 0m0.485s 0
1088 node current glob syncStream 0m0.740s 200023
1090 node fast-glob async 0m0.281s 0
1092 node current glob async mjs 0m0.544s 200023
1093 node current glob stream 0m0.464s 200023
1097 node fast-glob sync 0m0.486s 0
1100 node current glob syncStream 0m0.696s 200023
1102 node fast-glob async 0m0.286s 0
1104 node current glob async mjs 0m0.506s 200023
1105 node current glob stream 0m0.483s 200023
1109 node fast-glob sync 0m0.060s 0
1112 node current glob syncStream 0m0.066s 0
1114 node fast-glob async 0m0.060s 0
1116 node current glob async mjs 0m0.066s 0
1117 node current glob stream 0m0.067s 0
1121 node fast-glob sync 0m0.568s 100000
1124 node current glob syncStream 0m0.617s 100000
1126 node fast-glob async 0m0.332s 100000
1128 node current glob async mjs 0m0.372s 100000
1129 node current glob stream 0m0.351s 100000
1133 node fast-glob sync 0m0.603s 200113
1136 node current glob syncStream 0m0.693s 222137
1138 node fast-glob async 0m0.356s 200113
1140 node current glob async mjs 0m0.508s 222137
1141 node current glob stream 0m0.455s 222137
1145 node fast-glob sync 0m0.622s 200000
1148 node current glob syncStream 0m0.695s 200000
1150 node fast-glob async 0m0.369s 200000
1152 node current glob async mjs 0m0.502s 200000
1153 node current glob stream 0m0.481s 200000
1157 node fast-glob sync 0m0.588s 200023
1160 node current glob syncStream 0m0.658s 200023
1162 node fast-glob async 0m0.352s 200023
1164 node current glob async mjs 0m0.432s 200023
1165 node current glob stream 0m0.384s 200023
1169 node fast-glob sync 0m0.589s 200023
1172 node current glob syncStream 0m0.652s 200023
1174 node fast-glob async 0m0.352s 200023
1176 node current glob async mjs 0m0.436s 200023
1177 node current glob stream 0m0.380s 200023
1181 node fast-glob sync 0m0.592s 200023
1184 node current glob syncStream 0m0.659s 200023
1186 node fast-glob async 0m0.357s 200023
1188 node current glob async mjs 0m0.471s 200023
1189 node current glob stream 0m0.424s 200023
1193 node fast-glob sync 0m0.585s 200023
1196 node current glob syncStream 0m0.664s 200023
1198 node fast-glob async 0m0.350s 200023
1200 node current glob async mjs 0m0.472s 200023
1201 node current glob stream 0m0.424s 200023
1205 node fast-glob sync 0m0.544s 100000
1208 node current glob syncStream 0m0.621s 100000
1210 node fast-glob async 0m0.322s 100000
1212 node current glob async mjs 0m0.360s 100000
1213 node current glob stream 0m0.352s 100000