filehound 2.0.0-beta.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/README.md +39 -11
  2. package/dist/arrays.d.ts +1 -0
  3. package/dist/arrays.js +4 -0
  4. package/dist/file.d.ts +108 -0
  5. package/dist/file.js +184 -0
  6. package/dist/filehound.d.ts +356 -0
  7. package/dist/filehound.js +498 -0
  8. package/dist/files.d.ts +4 -0
  9. package/dist/files.js +37 -0
  10. package/dist/filetype.d.ts +10 -0
  11. package/dist/filetype.js +9 -0
  12. package/dist/index.d.ts +5 -0
  13. package/dist/index.js +6 -0
  14. package/dist/matchers.d.ts +324 -0
  15. package/dist/matchers.js +419 -0
  16. package/dist/walker/async.d.ts +4 -0
  17. package/dist/walker/async.js +237 -0
  18. package/dist/walker/heap.d.ts +7 -0
  19. package/dist/walker/heap.js +49 -0
  20. package/dist/walker/sync.d.ts +4 -0
  21. package/dist/walker/sync.js +66 -0
  22. package/dist/walker/walk.d.ts +33 -0
  23. package/dist/walker/walk.js +80 -0
  24. package/package.json +45 -48
  25. package/.github/stale.yml +0 -42
  26. package/.travis.yml +0 -8
  27. package/.vscode/launch.json +0 -21
  28. package/.vscode/settings.json +0 -3
  29. package/CONTRIBUTING.md +0 -8
  30. package/_config.yml +0 -1
  31. package/coverage/coverage.raw.json +0 -1
  32. package/coverage/lcov-report/arrays.ts.html +0 -98
  33. package/coverage/lcov-report/base.css +0 -212
  34. package/coverage/lcov-report/filehound.ts.html +0 -2078
  35. package/coverage/lcov-report/files.ts.html +0 -260
  36. package/coverage/lcov-report/functions.ts.html +0 -122
  37. package/coverage/lcov-report/index.html +0 -132
  38. package/coverage/lcov-report/prettify.css +0 -1
  39. package/coverage/lcov-report/prettify.js +0 -1
  40. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  41. package/coverage/lcov-report/sorter.js +0 -158
  42. package/coverage/lcov.info +0 -378
  43. package/dist/src/arrays.js +0 -15
  44. package/dist/src/arrays.js.map +0 -1
  45. package/dist/src/asyncWalker.js +0 -59
  46. package/dist/src/asyncWalker.js.map +0 -1
  47. package/dist/src/bind.js +0 -15
  48. package/dist/src/bind.js.map +0 -1
  49. package/dist/src/filehound.js +0 -597
  50. package/dist/src/filehound.js.map +0 -1
  51. package/dist/src/files.js +0 -60
  52. package/dist/src/files.js.map +0 -1
  53. package/dist/src/matcher.js +0 -51
  54. package/dist/src/matcher.js.map +0 -1
  55. package/dist/src/syncWalker.js +0 -47
  56. package/dist/src/syncWalker.js.map +0 -1
  57. package/dist/src/walkAsync.js +0 -33
  58. package/dist/src/walkAsync.js.map +0 -1
  59. package/dist/src/walkSync.js +0 -21
  60. package/dist/src/walkSync.js.map +0 -1
  61. package/dist/src/walker/walk.js +0 -68
  62. package/dist/src/walker/walk.js.map +0 -1
  63. package/dist/src/walker/walkAsync.js +0 -33
  64. package/dist/src/walker/walkAsync.js.map +0 -1
  65. package/dist/src/walker/walkSync.js +0 -21
  66. package/dist/src/walker/walkSync.js.map +0 -1
  67. package/dist/test/filehound.js +0 -872
  68. package/dist/test/filehound.js.map +0 -1
  69. package/dist/test/files.js +0 -29
  70. package/dist/test/files.js.map +0 -1
  71. package/docconfig/jsdoc.json +0 -26
  72. package/docconfig/template/LICENSE +0 -61
  73. package/docconfig/template/README.md +0 -86
  74. package/docconfig/template/package.json +0 -22
  75. package/docconfig/template/publish.js +0 -676
  76. package/docconfig/template/static/fonts/OpenSans-Bold-webfont.eot +0 -0
  77. package/docconfig/template/static/fonts/OpenSans-Bold-webfont.svg +0 -1830
  78. package/docconfig/template/static/fonts/OpenSans-Bold-webfont.woff +0 -0
  79. package/docconfig/template/static/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  80. package/docconfig/template/static/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  81. package/docconfig/template/static/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  82. package/docconfig/template/static/fonts/OpenSans-Italic-webfont.eot +0 -0
  83. package/docconfig/template/static/fonts/OpenSans-Italic-webfont.svg +0 -1830
  84. package/docconfig/template/static/fonts/OpenSans-Italic-webfont.woff +0 -0
  85. package/docconfig/template/static/fonts/OpenSans-Light-webfont.eot +0 -0
  86. package/docconfig/template/static/fonts/OpenSans-Light-webfont.svg +0 -1831
  87. package/docconfig/template/static/fonts/OpenSans-Light-webfont.woff +0 -0
  88. package/docconfig/template/static/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  89. package/docconfig/template/static/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  90. package/docconfig/template/static/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  91. package/docconfig/template/static/fonts/OpenSans-Regular-webfont.eot +0 -0
  92. package/docconfig/template/static/fonts/OpenSans-Regular-webfont.svg +0 -1831
  93. package/docconfig/template/static/fonts/OpenSans-Regular-webfont.woff +0 -0
  94. package/docconfig/template/static/fonts/OpenSans-Semibold-webfont.eot +0 -0
  95. package/docconfig/template/static/fonts/OpenSans-Semibold-webfont.svg +0 -1830
  96. package/docconfig/template/static/fonts/OpenSans-Semibold-webfont.ttf +0 -0
  97. package/docconfig/template/static/fonts/OpenSans-Semibold-webfont.woff +0 -0
  98. package/docconfig/template/static/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
  99. package/docconfig/template/static/fonts/OpenSans-SemiboldItalic-webfont.svg +0 -1830
  100. package/docconfig/template/static/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
  101. package/docconfig/template/static/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
  102. package/docconfig/template/static/scripts/linenumber.js +0 -25
  103. package/docconfig/template/static/scripts/prettify/Apache-License-2.0.txt +0 -202
  104. package/docconfig/template/static/scripts/prettify/lang-css.js +0 -2
  105. package/docconfig/template/static/scripts/prettify/prettify.js +0 -28
  106. package/docconfig/template/static/styles/jsdoc-default.css +0 -605
  107. package/docconfig/template/static/styles/prettify-jsdoc.css +0 -111
  108. package/docconfig/template/static/styles/prettify-tomorrow.css +0 -132
  109. package/docconfig/template/tmpl/augments.tmpl +0 -10
  110. package/docconfig/template/tmpl/container.tmpl +0 -183
  111. package/docconfig/template/tmpl/details.tmpl +0 -143
  112. package/docconfig/template/tmpl/example.tmpl +0 -2
  113. package/docconfig/template/tmpl/examples.tmpl +0 -13
  114. package/docconfig/template/tmpl/exceptions.tmpl +0 -32
  115. package/docconfig/template/tmpl/layout.tmpl +0 -47
  116. package/docconfig/template/tmpl/mainpage.tmpl +0 -10
  117. package/docconfig/template/tmpl/members.tmpl +0 -38
  118. package/docconfig/template/tmpl/method.tmpl +0 -105
  119. package/docconfig/template/tmpl/params.tmpl +0 -124
  120. package/docconfig/template/tmpl/properties.tmpl +0 -108
  121. package/docconfig/template/tmpl/returns.tmpl +0 -19
  122. package/docconfig/template/tmpl/source.tmpl +0 -8
  123. package/docconfig/template/tmpl/tutorial.tmpl +0 -19
  124. package/docconfig/template/tmpl/type.tmpl +0 -7
  125. package/docs/FileHound.html +0 -3079
  126. package/docs/FileHound_modified.html +0 -245
  127. package/docs/_config.yml +0 -1
  128. package/docs/filehound.js.html +0 -697
  129. package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  130. package/docs/fonts/OpenSans-Bold-webfont.svg +0 -1830
  131. package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  132. package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  133. package/docs/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  134. package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  135. package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  136. package/docs/fonts/OpenSans-Italic-webfont.svg +0 -1830
  137. package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  138. package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
  139. package/docs/fonts/OpenSans-Light-webfont.svg +0 -1831
  140. package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
  141. package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  142. package/docs/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  143. package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  144. package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  145. package/docs/fonts/OpenSans-Regular-webfont.svg +0 -1831
  146. package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  147. package/docs/fonts/OpenSans-Semibold-webfont.eot +0 -0
  148. package/docs/fonts/OpenSans-Semibold-webfont.svg +0 -1830
  149. package/docs/fonts/OpenSans-Semibold-webfont.ttf +0 -0
  150. package/docs/fonts/OpenSans-Semibold-webfont.woff +0 -0
  151. package/docs/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
  152. package/docs/fonts/OpenSans-SemiboldItalic-webfont.svg +0 -1830
  153. package/docs/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
  154. package/docs/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
  155. package/docs/global.html +0 -288
  156. package/docs/index.html +0 -154
  157. package/docs/scripts/linenumber.js +0 -25
  158. package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
  159. package/docs/scripts/prettify/lang-css.js +0 -2
  160. package/docs/scripts/prettify/prettify.js +0 -28
  161. package/docs/styles/jsdoc-default.css +0 -605
  162. package/docs/styles/prettify-jsdoc.css +0 -111
  163. package/docs/styles/prettify-tomorrow.css +0 -132
  164. package/docs.md +0 -164
  165. package/index.js +0 -1
  166. package/issue_template.md +0 -6
  167. package/test/filehound.ts +0 -1076
  168. package/test/files.ts +0 -29
  169. package/test/fixtures/custom/failed.txt +0 -0
  170. package/test/fixtures/custom/passed.txt +0 -0
  171. package/test/fixtures/deeplyNested/c.json +0 -0
  172. package/test/fixtures/deeplyNested/d.json +0 -0
  173. package/test/fixtures/deeplyNested/mydir/e.json +0 -0
  174. package/test/fixtures/deeplyNested/mydir/mydir2/f.json +0 -0
  175. package/test/fixtures/deeplyNested/mydir/mydir2/mydir3/mydir4/failed.json +0 -0
  176. package/test/fixtures/deeplyNested/mydir/mydir2/mydir3/z.json +0 -0
  177. package/test/fixtures/deeplyNested/mydir/mydir2/y.json +0 -0
  178. package/test/fixtures/deeplyNestedWithHiddenDir/c.json +0 -0
  179. package/test/fixtures/deeplyNestedWithHiddenDir/d.json +0 -0
  180. package/test/fixtures/deeplyNestedWithHiddenDir/mydir/e.json +0 -0
  181. package/test/fixtures/deeplyNestedWithHiddenDir/mydir/mydir2/f.json +0 -0
  182. package/test/fixtures/deeplyNestedWithHiddenDir/mydir/mydir2/mydir3/mydir4/.mydir5/.keep +0 -0
  183. package/test/fixtures/deeplyNestedWithHiddenDir/mydir/mydir2/mydir3/mydir4/failed.json +0 -0
  184. package/test/fixtures/deeplyNestedWithHiddenDir/mydir/mydir2/mydir3/z.json +0 -0
  185. package/test/fixtures/deeplyNestedWithHiddenDir/mydir/mydir2/y.json +0 -0
  186. package/test/fixtures/ext/Dummy.java +0 -0
  187. package/test/fixtures/ext/Dumpy.go +0 -0
  188. package/test/fixtures/ext/dummy.json +0 -0
  189. package/test/fixtures/ext/dummy.txt +0 -0
  190. package/test/fixtures/justFiles/a.json +0 -0
  191. package/test/fixtures/justFiles/b.json +0 -0
  192. package/test/fixtures/justFiles/dummy.txt +0 -0
  193. package/test/fixtures/mixed/a.json +0 -0
  194. package/test/fixtures/mixed/aabbcc.json +0 -0
  195. package/test/fixtures/mixed/ab.json +0 -0
  196. package/test/fixtures/mixed/z.json +0 -0
  197. package/test/fixtures/nested/.hidden1/bad.txt +0 -0
  198. package/test/fixtures/nested/c.json +0 -0
  199. package/test/fixtures/nested/d.json +0 -0
  200. package/test/fixtures/nested/mydir/e.json +0 -0
  201. package/test/fixtures/sizes/10b.txt +0 -0
  202. package/test/fixtures/sizes/1b.txt +0 -0
  203. package/test/fixtures/sizes/1k.txt +0 -0
  204. package/test/fixtures/sizes/2k.txt +0 -0
  205. package/test/fixtures/visibility/.hidden/.hidden.json +0 -0
  206. package/test/fixtures/visibility/.hidden/visible.json +0 -3
  207. package/test/fixtures/visibility/.hidden.json +0 -3
  208. package/test/fixtures/visibility/visible/.hidden.json +0 -3
  209. package/test/fixtures/visibility/visible.json +0 -3
  210. package/test/mocha.opts +0 -4
  211. package/tsconfig.json +0 -16
  212. package/tslint.json +0 -44
@@ -0,0 +1,356 @@
1
+ import { EventEmitter } from 'node:events';
2
+ import type { Stats } from 'node:fs';
3
+ import { type FilePredicate } from './matchers.js';
4
+ import { FileType } from './filetype.js';
5
+ /**
6
+ * Options for {@link FileHound.find} and {@link FileHound.iterate}.
7
+ */
8
+ export type SearchOptions = {
9
+ /**
10
+ * Stops the search when aborted. The search then rejects with the
11
+ * signal's reason, which is an `AbortError` unless another is given.
12
+ */
13
+ signal?: AbortSignal;
14
+ };
15
+ /**
16
+ * A match returned when {@link FileHound.includeFileStats} is set.
17
+ */
18
+ export type FileWithStats = {
19
+ /** the path of the matching file */
20
+ path: string;
21
+ /** the file's stats, as returned by `fs.stat` */
22
+ stats: Stats;
23
+ };
24
+ /**
25
+ * A fluent query for searching the file system.
26
+ *
27
+ * @typeParam T - the type of each match: a path, or a {@link FileWithStats}
28
+ * when {@link FileHound.includeFileStats} is set
29
+ *
30
+ * @remarks
31
+ * Configure a query by chaining methods, then run it with {@link FileHound.find}
32
+ * or {@link FileHound.findSync}. Once a search has started the query is locked
33
+ * and can no longer be modified.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import { FileHound, ext } from 'filehound';
38
+ *
39
+ * const files = await FileHound.create()
40
+ * .paths('/tmp')
41
+ * .match(ext('json'))
42
+ * .depth(1)
43
+ * .find();
44
+ * ```
45
+ */
46
+ export declare class FileHound<T = string> extends EventEmitter {
47
+ #private;
48
+ constructor();
49
+ /**
50
+ * Static factory method to create an instance of FileHound
51
+ *
52
+ * @returns a new FileHound instance
53
+ * @example
54
+ * ```ts
55
+ * import { FileHound } from 'filehound';
56
+ *
57
+ * const filehound = FileHound.create();
58
+ * ```
59
+ */
60
+ static create(): FileHound;
61
+ /**
62
+ * Executes one or more FileHound queries and combines their results
63
+ *
64
+ * @param args - the FileHound instances to execute
65
+ * @returns a Promise of all matches. If the Promise fulfils,
66
+ * the fulfilment value is an array of all files matched by any of the queries
67
+ * @example
68
+ * ```ts
69
+ * import { FileHound } from 'filehound';
70
+ *
71
+ * const files = await FileHound.any(fh1, fh2);
72
+ * ```
73
+ */
74
+ static any<T>(...args: FileHound<T>[]): Promise<T[]>;
75
+ /**
76
+ * Defines the search paths: the directories to search. Duplicate paths are
77
+ * removed and each path is normalised. Defaults to the current working directory.
78
+ *
79
+ * @param paths - one or more directory paths
80
+ * @returns the FileHound instance
81
+ * @throws `Error`
82
+ * Thrown if the query is locked because a search has started. A path that
83
+ * doesn't exist, or isn't a directory, is rejected when the search runs.
84
+ * @example
85
+ * ```ts
86
+ * import { FileHound } from 'filehound';
87
+ *
88
+ * const files = await FileHound.create()
89
+ * .paths('/tmp', '/etc') // or ['/tmp', '/etc']
90
+ * .find();
91
+ * ```
92
+ */
93
+ paths(...paths: string[]): this;
94
+ /**
95
+ * Defines the search paths from an array.
96
+ *
97
+ * @param paths - an array of paths
98
+ * @returns the FileHound instance
99
+ */
100
+ paths(paths: string[]): this;
101
+ /**
102
+ * Specifies the criteria that files must satisfy to be included in the
103
+ * results. Defaults to matching all files.
104
+ *
105
+ * @param query - the predicate used to test each file
106
+ * @returns the FileHound instance
107
+ * @throws `Error`
108
+ * Thrown if the query is locked because a search has started.
109
+ * @throws `TypeError`
110
+ * Thrown if the query is not a valid matcher.
111
+ * @example
112
+ * ```ts
113
+ * import { FileHound, ext } from 'filehound';
114
+ *
115
+ * const files = await FileHound.create()
116
+ * .match(ext('json'))
117
+ * .find();
118
+ * ```
119
+ */
120
+ match(query: FilePredicate): this;
121
+ /**
122
+ * Skips directories by name: a directory whose name matches any of the
123
+ * given names is neither searched nor returned. Use it to keep the search
124
+ * out of directories such as `node_modules`, which a {@link FileHound.match}
125
+ * predicate can only exclude from the results after searching them.
126
+ * Calling it again replaces the names.
127
+ *
128
+ * @remarks
129
+ * Each name is matched against a directory's name only, not its path,
130
+ * following Node's [`path.matchesGlob`](https://nodejs.org/api/path.html#pathmatchesglobpath-pattern).
131
+ * A plain name, such as `'node_modules'`, matches exactly, and a glob, such
132
+ * as `'build-*'`, matches any name it describes. Every directory below the
133
+ * search paths is tested, including linked directories, but not the search
134
+ * paths themselves.
135
+ *
136
+ * @param names - one or more directory names or globs
137
+ * @returns the FileHound instance
138
+ * @throws `Error`
139
+ * Thrown if the query is locked because a search has started.
140
+ * @throws `RangeError`
141
+ * Thrown if no names are given.
142
+ * @throws `TypeError`
143
+ * Thrown if a name is not a non-empty string, or contains a path separator.
144
+ * @example
145
+ * ```ts
146
+ * import { FileHound, ext } from 'filehound';
147
+ *
148
+ * const files = await FileHound.create()
149
+ * .skipDirectories('node_modules', '.git', 'build-*')
150
+ * .match(ext('js'))
151
+ * .find();
152
+ * ```
153
+ */
154
+ skipDirectories(...names: string[]): this;
155
+ /**
156
+ * Specify the directory search depth. If set to zero, recursive searching
157
+ * will be disabled. Directories at the limit are not searched, but are
158
+ * still returned when {@link FileHound.type} includes directories.
159
+ *
160
+ * @param depth - the maximum search depth (a non-negative integer)
161
+ * @returns the FileHound instance
162
+ * @throws `Error`
163
+ * Thrown if the query is locked because a search has started.
164
+ * @throws `RangeError`
165
+ * Thrown if depth is negative or not an integer.
166
+ * @example
167
+ * ```ts
168
+ * import { FileHound } from 'filehound';
169
+ *
170
+ * const files = await FileHound.create()
171
+ * .depth(0)
172
+ * .find(); // array of file names only in the current directory
173
+ * ```
174
+ */
175
+ depth(depth: number): this;
176
+ /**
177
+ * Specifies the types of file system entry to return. Defaults to
178
+ * regular files only.
179
+ *
180
+ * @param types - one or more file types
181
+ * @returns the FileHound instance
182
+ * @throws `Error`
183
+ * Thrown if the query is locked because a search has started.
184
+ * @throws `RangeError`
185
+ * Thrown if no file types are given.
186
+ * @throws `TypeError`
187
+ * Thrown if an invalid file type is given.
188
+ * @example
189
+ * ```ts
190
+ * import { FileHound, FileType } from 'filehound';
191
+ *
192
+ * const directories = await FileHound.create()
193
+ * .type(FileType.DIRECTORY)
194
+ * .find();
195
+ * ```
196
+ */
197
+ type(...types: FileType[]): this;
198
+ /**
199
+ * Excludes hidden files (names beginning with a dot) from the results
200
+ *
201
+ * @returns the FileHound instance
202
+ * @throws `Error`
203
+ * Thrown if the query is locked because a search has started.
204
+ * @example
205
+ * ```ts
206
+ * import { FileHound } from 'filehound';
207
+ *
208
+ * const files = await FileHound.create()
209
+ * .ignoreHiddenFiles()
210
+ * .find();
211
+ * ```
212
+ */
213
+ ignoreHiddenFiles(): this;
214
+ /**
215
+ * Excludes hidden directories (names beginning with a dot), and their
216
+ * contents, from the search
217
+ *
218
+ * @returns the FileHound instance
219
+ * @throws `Error`
220
+ * Thrown if the query is locked because a search has started.
221
+ * @example
222
+ * ```ts
223
+ * import { FileHound } from 'filehound';
224
+ *
225
+ * const files = await FileHound.create()
226
+ * .ignoreHiddenDirectories()
227
+ * .find();
228
+ * ```
229
+ */
230
+ ignoreHiddenDirectories(): this;
231
+ /**
232
+ * Excludes symbolic links from the search. Linked files are not matched
233
+ * and linked directories are not searched.
234
+ *
235
+ * @remarks
236
+ * By default, symbolic links are followed: a linked file is matched as its
237
+ * target and a linked directory is searched. Broken links, and links back to
238
+ * a directory already being searched, are always skipped.
239
+ *
240
+ * @returns the FileHound instance
241
+ * @throws `Error`
242
+ * Thrown if the query is locked because a search has started.
243
+ * @example
244
+ * ```ts
245
+ * import { FileHound } from 'filehound';
246
+ *
247
+ * const files = await FileHound.create()
248
+ * .ignoreSymlinks()
249
+ * .find();
250
+ * ```
251
+ */
252
+ ignoreSymlinks(): this;
253
+ /**
254
+ * Returns each match with its stats, as `{ path, stats }`, in place of
255
+ * its path. Stats already fetched by a predicate are reused.
256
+ *
257
+ * @returns the FileHound instance, typed to return {@link FileWithStats} matches
258
+ * @throws `Error`
259
+ * Thrown if the query is locked because a search has started.
260
+ * @example
261
+ * ```ts
262
+ * import { FileHound } from 'filehound';
263
+ *
264
+ * const files = await FileHound.create()
265
+ * .includeFileStats()
266
+ * .find();
267
+ *
268
+ * files.forEach(({ path, stats }) => console.log(path, stats.size));
269
+ * ```
270
+ */
271
+ includeFileStats(): FileHound<FileWithStats>;
272
+ /**
273
+ * Asynchronously executes a file search. Once called, the query is
274
+ * locked and can no longer be modified.
275
+ *
276
+ * @param options - a signal to stop the search
277
+ * @returns a Promise of all matches. If the Promise fulfils,
278
+ * the fulfilment value is an array of all matching files
279
+ *
280
+ * @remarks
281
+ * Emits a `match` event for each matching file, an `error` event if the
282
+ * search fails or is aborted and an `end` event when the search completes.
283
+ *
284
+ * @example
285
+ * ```ts
286
+ * import { FileHound } from 'filehound';
287
+ *
288
+ * const filehound = FileHound.create();
289
+ * const files = await filehound.find();
290
+ *
291
+ * console.log(files);
292
+ * ```
293
+ * @example
294
+ * Giving up on a search after five seconds:
295
+ * ```ts
296
+ * const files = await FileHound.create()
297
+ * .paths('/')
298
+ * .find({ signal: AbortSignal.timeout(5000) });
299
+ * ```
300
+ */
301
+ find(options?: SearchOptions): Promise<T[]>;
302
+ /**
303
+ * Asynchronously executes a file search, returning matches one at a time
304
+ * as they are found, in the same order as {@link FileHound.find}. Once
305
+ * called, the query is locked and can no longer be modified.
306
+ *
307
+ * @remarks
308
+ * The search runs ahead of the loop by a bounded amount, so a large search
309
+ * can be read without holding every match in memory. Breaking out of the
310
+ * loop stops the search.
311
+ *
312
+ * Emits a `match` event as each match is returned, an `error` event if the
313
+ * search fails or is aborted and an `end` event when the search finishes:
314
+ * when every match has been returned, the search fails or is aborted, or
315
+ * the loop is left early.
316
+ *
317
+ * @param options - a signal to stop the search
318
+ * @returns an async iterator of matches
319
+ * @example
320
+ * ```ts
321
+ * import { FileHound, ext } from 'filehound';
322
+ *
323
+ * const query = FileHound.create()
324
+ * .paths('/tmp')
325
+ * .match(ext('json'));
326
+ *
327
+ * for await (const file of query.iterate()) {
328
+ * console.log(file);
329
+ * }
330
+ * ```
331
+ */
332
+ iterate(options?: SearchOptions): AsyncGenerator<T>;
333
+ /**
334
+ * Synchronously executes a file search. Once called, the query is
335
+ * locked and can no longer be modified. No events are emitted.
336
+ *
337
+ * @returns an array of all matching files
338
+ * @example
339
+ * ```ts
340
+ * import { FileHound } from 'filehound';
341
+ *
342
+ * const filehound = FileHound.create();
343
+ * const files = filehound.findSync();
344
+ * console.log(files);
345
+ * ```
346
+ */
347
+ findSync(): T[];
348
+ /**
349
+ * Returns the paths that will be searched. When no depth is set, any path
350
+ * that is a subdirectory of another search path is removed, as it would
351
+ * otherwise be searched twice.
352
+ *
353
+ * @returns a copy of the search paths
354
+ */
355
+ getPaths(): string[];
356
+ }