1 | import { Glob } from 'glob';
|
2 | import { fs, fsPath } from './libs';
|
3 |
|
4 | export interface IGlobOptions {
|
5 | nodir?: boolean;
|
6 | dot?: boolean;
|
7 | ignore?: string;
|
8 | }
|
9 |
|
10 | /**
|
11 | * Matches the given glob pattern as a promise.
|
12 | * See:
|
13 | * https://www.npmjs.com/package/glob
|
14 | */
|
15 | export function find(
|
16 | pattern: string,
|
17 | options: IGlobOptions = {},
|
18 | ): Promise<string[]> {
|
19 | return new Promise<string[]>((resolve, reject) => {
|
20 | new Glob(pattern, options, (err, matches) => {
|
21 | // tslint:disable-line
|
22 | if (err) {
|
23 | reject(err);
|
24 | } else {
|
25 | resolve(matches);
|
26 | }
|
27 | });
|
28 | });
|
29 | }
|
30 |
|
\ | No newline at end of file |