Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795
  1. # fast-glob
  2. > It's a very fast and efficient [glob][glob_definition] library for [Node.js][node_js].
  3. This package provides methods for traversing the file system and returning pathnames that matched a defined set of a specified pattern according to the rules used by the Unix Bash shell with some simplifications, meanwhile results are returned in **arbitrary order**. Quick, simple, effective.
  4. ## Table of Contents
  5. <details>
  6. <summary><strong>Details</strong></summary>
  7. * [Highlights](#highlights)
  8. * [Donation](#donation)
  9. * [Old and modern mode](#old-and-modern-mode)
  10. * [Pattern syntax](#pattern-syntax)
  11. * [Basic syntax](#basic-syntax)
  12. * [Advanced syntax](#advanced-syntax)
  13. * [Installation](#installation)
  14. * [API](#api)
  15. * [Asynchronous](#asynchronous)
  16. * [Synchronous](#synchronous)
  17. * [Stream](#stream)
  18. * [patterns](#patterns)
  19. * [[options]](#options)
  20. * [Helpers](#helpers)
  21. * [generateTasks](#generatetaskspatterns-options)
  22. * [isDynamicPattern](#isdynamicpatternpattern-options)
  23. * [escapePath](#escapepathpattern)
  24. * [Options](#options-3)
  25. * [Common](#common)
  26. * [concurrency](#concurrency)
  27. * [cwd](#cwd)
  28. * [deep](#deep)
  29. * [followSymbolicLinks](#followsymboliclinks)
  30. * [fs](#fs)
  31. * [ignore](#ignore)
  32. * [suppressErrors](#suppresserrors)
  33. * [throwErrorOnBrokenSymbolicLink](#throwerroronbrokensymboliclink)
  34. * [Output control](#output-control)
  35. * [absolute](#absolute)
  36. * [markDirectories](#markdirectories)
  37. * [objectMode](#objectmode)
  38. * [onlyDirectories](#onlydirectories)
  39. * [onlyFiles](#onlyfiles)
  40. * [stats](#stats)
  41. * [unique](#unique)
  42. * [Matching control](#matching-control)
  43. * [braceExpansion](#braceexpansion)
  44. * [caseSensitiveMatch](#casesensitivematch)
  45. * [dot](#dot)
  46. * [extglob](#extglob)
  47. * [globstar](#globstar)
  48. * [baseNameMatch](#basenamematch)
  49. * [FAQ](#faq)
  50. * [What is a static or dynamic pattern?](#what-is-a-static-or-dynamic-pattern)
  51. * [How to write patterns on Windows?](#how-to-write-patterns-on-windows)
  52. * [Why are parentheses match wrong?](#why-are-parentheses-match-wrong)
  53. * [How to exclude directory from reading?](#how-to-exclude-directory-from-reading)
  54. * [How to use UNC path?](#how-to-use-unc-path)
  55. * [Compatible with `node-glob`?](#compatible-with-node-glob)
  56. * [Benchmarks](#benchmarks)
  57. * [Server](#server)
  58. * [Nettop](#nettop)
  59. * [Changelog](#changelog)
  60. * [License](#license)
  61. </details>
  62. ## Highlights
  63. * Fast. Probably the fastest.
  64. * Supports multiple and negative patterns.
  65. * Synchronous, Promise and Stream API.
  66. * Object mode. Can return more than just strings.
  67. * Error-tolerant.
  68. ## Donation
  69. Do you like this project? Support it by donating, creating an issue or pull request.
  70. [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)][paypal_mrmlnc]
  71. ## Old and modern mode
  72. This package works in two modes, depending on the environment in which it is used.
  73. * **Old mode**. Node.js below 10.10 or when the [`stats`](#stats) option is *enabled*.
  74. * **Modern mode**. Node.js 10.10+ and the [`stats`](#stats) option is *disabled*.
  75. The modern mode is faster. Learn more about the [internal mechanism][nodelib_fs_scandir_old_and_modern_modern].
  76. ## Pattern syntax
  77. > :warning: Always use forward-slashes in glob expressions (patterns and [`ignore`](#ignore) option). Use backslashes for escaping characters.
  78. There is more than one form of syntax: basic and advanced. Below is a brief overview of the supported features. Also pay attention to our [FAQ](#faq).
  79. > :book: This package uses a [`micromatch`][micromatch] as a library for pattern matching.
  80. ### Basic syntax
  81. * An asterisk (`*`) — matches everything except slashes (path separators), hidden files (names starting with `.`).
  82. * A double star or globstar (`**`) — matches zero or more directories.
  83. * Question mark (`?`) – matches any single character except slashes (path separators).
  84. * Sequence (`[seq]`) — matches any character in sequence.
  85. > :book: A few additional words about the [basic matching behavior][picomatch_matching_behavior].
  86. Some examples:
  87. * `src/**/*.js` — matches all files in the `src` directory (any level of nesting) that have the `.js` extension.
  88. * `src/*.??` — matches all files in the `src` directory (only first level of nesting) that have a two-character extension.
  89. * `file-[01].js` — matches files: `file-0.js`, `file-1.js`.
  90. ### Advanced syntax
  91. * [Escapes characters][micromatch_backslashes] (`\\`) — matching special characters (`$^*+?()[]`) as literals.
  92. * [POSIX character classes][picomatch_posix_brackets] (`[[:digit:]]`).
  93. * [Extended globs][micromatch_extglobs] (`?(pattern-list)`).
  94. * [Bash style brace expansions][micromatch_braces] (`{}`).
  95. * [Regexp character classes][micromatch_regex_character_classes] (`[1-5]`).
  96. * [Regex groups][regular_expressions_brackets] (`(a|b)`).
  97. > :book: A few additional words about the [advanced matching behavior][micromatch_extended_globbing].
  98. Some examples:
  99. * `src/**/*.{css,scss}` — matches all files in the `src` directory (any level of nesting) that have the `.css` or `.scss` extension.
  100. * `file-[[:digit:]].js` — matches files: `file-0.js`, `file-1.js`, …, `file-9.js`.
  101. * `file-{1..3}.js` — matches files: `file-1.js`, `file-2.js`, `file-3.js`.
  102. * `file-(1|2)` — matches files: `file-1.js`, `file-2.js`.
  103. ## Installation
  104. ```console
  105. npm install fast-glob
  106. ```
  107. ## API
  108. ### Asynchronous
  109. ```js
  110. fg(patterns, [options])
  111. ```
  112. Returns a `Promise` with an array of matching entries.
  113. ```js
  114. const fg = require('fast-glob');
  115. const entries = await fg(['.editorconfig', '**/index.js'], { dot: true });
  116. // ['.editorconfig', 'services/index.js']
  117. ```
  118. ### Synchronous
  119. ```js
  120. fg.sync(patterns, [options])
  121. ```
  122. Returns an array of matching entries.
  123. ```js
  124. const fg = require('fast-glob');
  125. const entries = fg.sync(['.editorconfig', '**/index.js'], { dot: true });
  126. // ['.editorconfig', 'services/index.js']
  127. ```
  128. ### Stream
  129. ```js
  130. fg.stream(patterns, [options])
  131. ```
  132. Returns a [`ReadableStream`][node_js_stream_readable_streams] when the `data` event will be emitted with matching entry.
  133. ```js
  134. const fg = require('fast-glob');
  135. const stream = fg.stream(['.editorconfig', '**/index.js'], { dot: true });
  136. for await (const entry of stream) {
  137. // .editorconfig
  138. // services/index.js
  139. }
  140. ```
  141. #### patterns
  142. * Required: `true`
  143. * Type: `string | string[]`
  144. Any correct pattern(s).
  145. > :1234: [Pattern syntax](#pattern-syntax)
  146. >
  147. > :warning: This package does not respect the order of patterns. First, all the negative patterns are applied, and only then the positive patterns. If you want to get a certain order of records, use sorting or split calls.
  148. #### [options]
  149. * Required: `false`
  150. * Type: [`Options`](#options-3)
  151. See [Options](#options-3) section.
  152. ### Helpers
  153. #### `generateTasks(patterns, [options])`
  154. Returns the internal representation of patterns ([`Task`](./src/managers/tasks.ts) is a combining patterns by base directory).
  155. ```js
  156. fg.generateTasks('*');
  157. [{
  158. base: '.', // Parent directory for all patterns inside this task
  159. dynamic: true, // Dynamic or static patterns are in this task
  160. patterns: ['*'],
  161. positive: ['*'],
  162. negative: []
  163. }]
  164. ```
  165. ##### patterns
  166. * Required: `true`
  167. * Type: `string | string[]`
  168. Any correct pattern(s).
  169. ##### [options]
  170. * Required: `false`
  171. * Type: [`Options`](#options-3)
  172. See [Options](#options-3) section.
  173. #### `isDynamicPattern(pattern, [options])`
  174. Returns `true` if the passed pattern is a dynamic pattern.
  175. > :1234: [What is a static or dynamic pattern?](#what-is-a-static-or-dynamic-pattern)
  176. ```js
  177. fg.isDynamicPattern('*'); // true
  178. fg.isDynamicPattern('abc'); // false
  179. ```
  180. ##### pattern
  181. * Required: `true`
  182. * Type: `string`
  183. Any correct pattern.
  184. ##### [options]
  185. * Required: `false`
  186. * Type: [`Options`](#options-3)
  187. See [Options](#options-3) section.
  188. #### `escapePath(pattern)`
  189. Returns a path with escaped special characters (`*?|(){}[]`, `!` at the beginning of line, `@+!` before the opening parenthesis).
  190. ```js
  191. fg.escapePath('!abc'); // \\!abc
  192. fg.escapePath('C:/Program Files (x86)'); // C:/Program Files \\(x86\\)
  193. ```
  194. ##### pattern
  195. * Required: `true`
  196. * Type: `string`
  197. Any string, for example, a path to a file.
  198. ## Options
  199. ### Common options
  200. #### concurrency
  201. * Type: `number`
  202. * Default: `os.cpus().length`
  203. Specifies the maximum number of concurrent requests from a reader to read directories.
  204. > :book: The higher the number, the higher the performance and load on the file system. If you want to read in quiet mode, set the value to a comfortable number or `1`.
  205. #### cwd
  206. * Type: `string`
  207. * Default: `process.cwd()`
  208. The current working directory in which to search.
  209. #### deep
  210. * Type: `number`
  211. * Default: `Infinity`
  212. Specifies the maximum depth of a read directory relative to the start directory.
  213. For example, you have the following tree:
  214. ```js
  215. dir/
  216. └── one/ // 1
  217. └── two/ // 2
  218. └── file.js // 3
  219. ```
  220. ```js
  221. // With base directory
  222. fg.sync('dir/**', { onlyFiles: false, deep: 1 }); // ['dir/one']
  223. fg.sync('dir/**', { onlyFiles: false, deep: 2 }); // ['dir/one', 'dir/one/two']
  224. // With cwd option
  225. fg.sync('**', { onlyFiles: false, cwd: 'dir', deep: 1 }); // ['one']
  226. fg.sync('**', { onlyFiles: false, cwd: 'dir', deep: 2 }); // ['one', 'one/two']
  227. ```
  228. > :book: If you specify a pattern with some base directory, this directory will not participate in the calculation of the depth of the found directories. Think of it as a [`cwd`](#cwd) option.
  229. #### followSymbolicLinks
  230. * Type: `boolean`
  231. * Default: `true`
  232. Indicates whether to traverse descendants of symbolic link directories when expanding `**` patterns.
  233. > :book: Note that this option does not affect the base directory of the pattern. For example, if `./a` is a symlink to directory `./b` and you specified `['./a**', './b/**']` patterns, then directory `./a` will still be read.
  234. > :book: If the [`stats`](#stats) option is specified, the information about the symbolic link (`fs.lstat`) will be replaced with information about the entry (`fs.stat`) behind it.
  235. #### fs
  236. * Type: `FileSystemAdapter`
  237. * Default: `fs.*`
  238. Custom implementation of methods for working with the file system.
  239. ```ts
  240. export interface FileSystemAdapter {
  241. lstat?: typeof fs.lstat;
  242. stat?: typeof fs.stat;
  243. lstatSync?: typeof fs.lstatSync;
  244. statSync?: typeof fs.statSync;
  245. readdir?: typeof fs.readdir;
  246. readdirSync?: typeof fs.readdirSync;
  247. }
  248. ```
  249. #### ignore
  250. * Type: `string[]`
  251. * Default: `[]`
  252. An array of glob patterns to exclude matches. This is an alternative way to use negative patterns.
  253. ```js
  254. dir/
  255. ├── package-lock.json
  256. └── package.json
  257. ```
  258. ```js
  259. fg.sync(['*.json', '!package-lock.json']); // ['package.json']
  260. fg.sync('*.json', { ignore: ['package-lock.json'] }); // ['package.json']
  261. ```
  262. #### suppressErrors
  263. * Type: `boolean`
  264. * Default: `false`
  265. By default this package suppress only `ENOENT` errors. Set to `true` to suppress any error.
  266. > :book: Can be useful when the directory has entries with a special level of access.
  267. #### throwErrorOnBrokenSymbolicLink
  268. * Type: `boolean`
  269. * Default: `false`
  270. Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`.
  271. > :book: This option has no effect on errors when reading the symbolic link directory.
  272. ### Output control
  273. #### absolute
  274. * Type: `boolean`
  275. * Default: `false`
  276. Return the absolute path for entries.
  277. ```js
  278. fg.sync('*.js', { absolute: false }); // ['index.js']
  279. fg.sync('*.js', { absolute: true }); // ['/home/user/index.js']
  280. ```
  281. > :book: This option is required if you want to use negative patterns with absolute path, for example, `!${__dirname}/*.js`.
  282. #### markDirectories
  283. * Type: `boolean`
  284. * Default: `false`
  285. Mark the directory path with the final slash.
  286. ```js
  287. fg.sync('*', { onlyFiles: false, markDirectories: false }); // ['index.js', 'controllers']
  288. fg.sync('*', { onlyFiles: false, markDirectories: true }); // ['index.js', 'controllers/']
  289. ```
  290. #### objectMode
  291. * Type: `boolean`
  292. * Default: `false`
  293. Returns objects (instead of strings) describing entries.
  294. ```js
  295. fg.sync('*', { objectMode: false }); // ['src/index.js']
  296. fg.sync('*', { objectMode: true }); // [{ name: 'index.js', path: 'src/index.js', dirent: <fs.Dirent> }]
  297. ```
  298. The object has the following fields:
  299. * name (`string`) — the last part of the path (basename)
  300. * path (`string`) — full path relative to the pattern base directory
  301. * dirent ([`fs.Dirent`][node_js_fs_class_fs_dirent]) — instance of `fs.Direct`
  302. > :book: An object is an internal representation of entry, so getting it does not affect performance.
  303. #### onlyDirectories
  304. * Type: `boolean`
  305. * Default: `false`
  306. Return only directories.
  307. ```js
  308. fg.sync('*', { onlyDirectories: false }); // ['index.js', 'src']
  309. fg.sync('*', { onlyDirectories: true }); // ['src']
  310. ```
  311. > :book: If `true`, the [`onlyFiles`](#onlyfiles) option is automatically `false`.
  312. #### onlyFiles
  313. * Type: `boolean`
  314. * Default: `true`
  315. Return only files.
  316. ```js
  317. fg.sync('*', { onlyFiles: false }); // ['index.js', 'src']
  318. fg.sync('*', { onlyFiles: true }); // ['index.js']
  319. ```
  320. #### stats
  321. * Type: `boolean`
  322. * Default: `false`
  323. Enables an [object mode](#objectmode) with an additional field:
  324. * stats ([`fs.Stats`][node_js_fs_class_fs_stats]) — instance of `fs.Stats`
  325. ```js
  326. fg.sync('*', { stats: false }); // ['src/index.js']
  327. fg.sync('*', { stats: true }); // [{ name: 'index.js', path: 'src/index.js', dirent: <fs.Dirent>, stats: <fs.Stats> }]
  328. ```
  329. > :book: Returns `fs.stat` instead of `fs.lstat` for symbolic links when the [`followSymbolicLinks`](#followsymboliclinks) option is specified.
  330. >
  331. > :warning: Unlike [object mode](#objectmode) this mode requires additional calls to the file system. On average, this mode is slower at least twice. See [old and modern mode](#old-and-modern-mode) for more details.
  332. #### unique
  333. * Type: `boolean`
  334. * Default: `true`
  335. Ensures that the returned entries are unique.
  336. ```js
  337. fg.sync(['*.json', 'package.json'], { unique: false }); // ['package.json', 'package.json']
  338. fg.sync(['*.json', 'package.json'], { unique: true }); // ['package.json']
  339. ```
  340. If `true` and similar entries are found, the result is the first found.
  341. ### Matching control
  342. #### braceExpansion
  343. * Type: `boolean`
  344. * Default: `true`
  345. Enables Bash-like brace expansion.
  346. > :1234: [Syntax description][bash_hackers_syntax_expansion_brace] or more [detailed description][micromatch_braces].
  347. ```js
  348. dir/
  349. ├── abd
  350. ├── acd
  351. └── a{b,c}d
  352. ```
  353. ```js
  354. fg.sync('a{b,c}d', { braceExpansion: false }); // ['a{b,c}d']
  355. fg.sync('a{b,c}d', { braceExpansion: true }); // ['abd', 'acd']
  356. ```
  357. #### caseSensitiveMatch
  358. * Type: `boolean`
  359. * Default: `true`
  360. Enables a [case-sensitive][wikipedia_case_sensitivity] mode for matching files.
  361. ```js
  362. dir/
  363. ├── file.txt
  364. └── File.txt
  365. ```
  366. ```js
  367. fg.sync('file.txt', { caseSensitiveMatch: false }); // ['file.txt', 'File.txt']
  368. fg.sync('file.txt', { caseSensitiveMatch: true }); // ['file.txt']
  369. ```
  370. #### dot
  371. * Type: `boolean`
  372. * Default: `false`
  373. Allow patterns to match entries that begin with a period (`.`).
  374. > :book: Note that an explicit dot in a portion of the pattern will always match dot files.
  375. ```js
  376. dir/
  377. ├── .editorconfig
  378. └── package.json
  379. ```
  380. ```js
  381. fg.sync('*', { dot: false }); // ['package.json']
  382. fg.sync('*', { dot: true }); // ['.editorconfig', 'package.json']
  383. ```
  384. #### extglob
  385. * Type: `boolean`
  386. * Default: `true`
  387. Enables Bash-like `extglob` functionality.
  388. > :1234: [Syntax description][micromatch_extglobs].
  389. ```js
  390. dir/
  391. ├── README.md
  392. └── package.json
  393. ```
  394. ```js
  395. fg.sync('*.+(json|md)', { extglob: false }); // []
  396. fg.sync('*.+(json|md)', { extglob: true }); // ['README.md', 'package.json']
  397. ```
  398. #### globstar
  399. * Type: `boolean`
  400. * Default: `true`
  401. Enables recursively repeats a pattern containing `**`. If `false`, `**` behaves exactly like `*`.
  402. ```js
  403. dir/
  404. └── a
  405. └── b
  406. ```
  407. ```js
  408. fg.sync('**', { onlyFiles: false, globstar: false }); // ['a']
  409. fg.sync('**', { onlyFiles: false, globstar: true }); // ['a', 'a/b']
  410. ```
  411. #### baseNameMatch
  412. * Type: `boolean`
  413. * Default: `false`
  414. If set to `true`, then patterns without slashes will be matched against the basename of the path if it contains slashes.
  415. ```js
  416. dir/
  417. └── one/
  418. └── file.md
  419. ```
  420. ```js
  421. fg.sync('*.md', { baseNameMatch: false }); // []
  422. fg.sync('*.md', { baseNameMatch: true }); // ['one/file.md']
  423. ```
  424. ## FAQ
  425. ## What is a static or dynamic pattern?
  426. All patterns can be divided into two types:
  427. * **static**. A pattern is considered static if it can be used to get an entry on the file system without using matching mechanisms. For example, the `file.js` pattern is a static pattern because we can just verify that it exists on the file system.
  428. * **dynamic**. A pattern is considered dynamic if it cannot be used directly to find occurrences without using a matching mechanisms. For example, the `*` pattern is a dynamic pattern because we cannot use this pattern directly.
  429. A pattern is considered dynamic if it contains the following characters (`…` — any characters or their absence) or options:
  430. * The [`caseSensitiveMatch`](#casesensitivematch) option is disabled
  431. * `\\` (the escape character)
  432. * `*`, `?`, `!` (at the beginning of line)
  433. * `[…]`
  434. * `(…|…)`
  435. * `@(…)`, `!(…)`, `*(…)`, `?(…)`, `+(…)` (respects the [`extglob`](#extglob) option)
  436. * `{…,…}`, `{…..…}` (respects the [`braceExpansion`](#braceexpansion) option)
  437. ## How to write patterns on Windows?
  438. Always use forward-slashes in glob expressions (patterns and [`ignore`](#ignore) option). Use backslashes for escaping characters. With the [`cwd`](#cwd) option use a convenient format.
  439. **Bad**
  440. ```ts
  441. [
  442. 'directory\\*',
  443. path.join(process.cwd(), '**')
  444. ]
  445. ```
  446. **Good**
  447. ```ts
  448. [
  449. 'directory/*',
  450. path.join(process.cwd(), '**').replace(/\\/g, '/')
  451. ]
  452. ```
  453. > :book: Use the [`normalize-path`][npm_normalize_path] or the [`unixify`][npm_unixify] package to convert Windows-style path to a Unix-style path.
  454. Read more about [matching with backslashes][micromatch_backslashes].
  455. ## Why are parentheses match wrong?
  456. ```js
  457. dir/
  458. └── (special-*file).txt
  459. ```
  460. ```js
  461. fg.sync(['(special-*file).txt']) // []
  462. ```
  463. Refers to Bash. You need to escape special characters:
  464. ```js
  465. fg.sync(['\\(special-*file\\).txt']) // ['(special-*file).txt']
  466. ```
  467. Read more about [matching special characters as literals][picomatch_matching_special_characters_as_literals].
  468. ## How to exclude directory from reading?
  469. You can use a negative pattern like this: `!**/node_modules` or `!**/node_modules/**`. Also you can use [`ignore`](#ignore) option. Just look at the example below.
  470. ```js
  471. first/
  472. ├── file.md
  473. └── second/
  474. └── file.txt
  475. ```
  476. If you don't want to read the `second` directory, you must write the following pattern: `!**/second` or `!**/second/**`.
  477. ```js
  478. fg.sync(['**/*.md', '!**/second']); // ['first/file.md']
  479. fg.sync(['**/*.md'], { ignore: ['**/second/**'] }); // ['first/file.md']
  480. ```
  481. > :warning: When you write `!**/second/**/*` it means that the directory will be **read**, but all the entries will not be included in the results.
  482. You have to understand that if you write the pattern to exclude directories, then the directory will not be read under any circumstances.
  483. ## How to use UNC path?
  484. You cannot use [Uniform Naming Convention (UNC)][unc_path] paths as patterns (due to syntax), but you can use them as [`cwd`](#cwd) directory.
  485. ```ts
  486. fg.sync('*', { cwd: '\\\\?\\C:\\Python27' /* or //?/C:/Python27 */ });
  487. fg.sync('Python27/*', { cwd: '\\\\?\\C:\\' /* or //?/C:/ */ });
  488. ```
  489. ## Compatible with `node-glob`?
  490. | node-glob | fast-glob |
  491. | :----------: | :-------: |
  492. | `cwd` | [`cwd`](#cwd) |
  493. | `root` | – |
  494. | `dot` | [`dot`](#dot) |
  495. | `nomount` | – |
  496. | `mark` | [`markDirectories`](#markdirectories) |
  497. | `nosort` | – |
  498. | `nounique` | [`unique`](#unique) |
  499. | `nobrace` | [`braceExpansion`](#braceexpansion) |
  500. | `noglobstar` | [`globstar`](#globstar) |
  501. | `noext` | [`extglob`](#extglob) |
  502. | `nocase` | [`caseSensitiveMatch`](#casesensitivematch) |
  503. | `matchBase` | [`baseNameMatch`](#basenamematch) |
  504. | `nodir` | [`onlyFiles`](#onlyfiles) |
  505. | `ignore` | [`ignore`](#ignore) |
  506. | `follow` | [`followSymbolicLinks`](#followsymboliclinks) |
  507. | `realpath` | – |
  508. | `absolute` | [`absolute`](#absolute) |
  509. ## Benchmarks
  510. ### Server
  511. Link: [Vultr Bare Metal][vultr_pricing_baremetal]
  512. * Processor: E3-1270v6 (8 CPU)
  513. * RAM: 32GB
  514. * Disk: SSD ([Intel DC S3520 SSDSC2BB240G7][intel_ssd])
  515. You can see results [here][github_gist_benchmark_server] for latest release.
  516. ### Nettop
  517. Link: [Zotac bi323][zotac_bi323]
  518. * Processor: Intel N3150 (4 CPU)
  519. * RAM: 8GB
  520. * Disk: SSD ([Silicon Power SP060GBSS3S55S25][silicon_power_ssd])
  521. You can see results [here][github_gist_benchmark_nettop] for latest release.
  522. ## Changelog
  523. See the [Releases section of our GitHub project][github_releases] for changelog for each release version.
  524. ## License
  525. This software is released under the terms of the MIT license.
  526. [bash_hackers_syntax_expansion_brace]: https://wiki.bash-hackers.org/syntax/expansion/brace
  527. [github_gist_benchmark_nettop]: https://gist.github.com/mrmlnc/f06246b197f53c356895fa35355a367c#file-fg-benchmark-nettop-product-txt
  528. [github_gist_benchmark_server]: https://gist.github.com/mrmlnc/f06246b197f53c356895fa35355a367c#file-fg-benchmark-server-product-txt
  529. [github_releases]: https://github.com/mrmlnc/fast-glob/releases
  530. [glob_definition]: https://en.wikipedia.org/wiki/Glob_(programming)
  531. [glob_linux_man]: http://man7.org/linux/man-pages/man3/glob.3.html
  532. [intel_ssd]: https://ark.intel.com/content/www/us/en/ark/products/93012/intel-ssd-dc-s3520-series-240gb-2-5in-sata-6gb-s-3d1-mlc.html
  533. [micromatch_backslashes]: https://github.com/micromatch/micromatch#backslashes
  534. [micromatch_braces]: https://github.com/micromatch/braces
  535. [micromatch_extended_globbing]: https://github.com/micromatch/micromatch#extended-globbing
  536. [micromatch_extglobs]: https://github.com/micromatch/micromatch#extglobs
  537. [micromatch_regex_character_classes]: https://github.com/micromatch/micromatch#regex-character-classes
  538. [micromatch]: https://github.com/micromatch/micromatch
  539. [node_js_fs_class_fs_dirent]: https://nodejs.org/api/fs.html#fs_class_fs_dirent
  540. [node_js_fs_class_fs_stats]: https://nodejs.org/api/fs.html#fs_class_fs_stats
  541. [node_js_stream_readable_streams]: https://nodejs.org/api/stream.html#stream_readable_streams
  542. [node_js]: https://nodejs.org/en
  543. [nodelib_fs_scandir_old_and_modern_modern]: https://github.com/nodelib/nodelib/blob/master/packages/fs/fs.scandir/README.md#old-and-modern-mode
  544. [npm_normalize_path]: https://www.npmjs.com/package/normalize-path
  545. [npm_unixify]: https://www.npmjs.com/package/unixify
  546. [paypal_mrmlnc]:https://paypal.me/mrmlnc
  547. [picomatch_matching_behavior]: https://github.com/micromatch/picomatch#matching-behavior-vs-bash
  548. [picomatch_matching_special_characters_as_literals]: https://github.com/micromatch/picomatch#matching-special-characters-as-literals
  549. [picomatch_posix_brackets]: https://github.com/micromatch/picomatch#posix-brackets
  550. [regular_expressions_brackets]: https://www.regular-expressions.info/brackets.html
  551. [silicon_power_ssd]: https://www.silicon-power.com/web/product-1
  552. [unc_path]: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/62e862f4-2a51-452e-8eeb-dc4ff5ee33cc
  553. [vultr_pricing_baremetal]: https://www.vultr.com/pricing/baremetal
  554. [wikipedia_case_sensitivity]: https://en.wikipedia.org/wiki/Case_sensitivity
  555. [zotac_bi323]: https://www.zotac.com/ee/product/mini_pcs/zbox-bi323