index.d.ts
2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import {IOptions as GlobOptions} from 'glob';
declare namespace del {
interface Options extends Readonly<GlobOptions> {
/**
Allow deleting the current working directory and outside.
@default false
*/
readonly force?: boolean;
/**
See what would be deleted.
@default false
@example
```
import del = require('del');
(async () => {
const deletedPaths = await del(['tmp/*.js'], {dryRun: true});
console.log('Files and folders that would be deleted:\n', deletedPaths.join('\n'));
})();
```
*/
readonly dryRun?: boolean;
/**
Concurrency limit. Minimum: `1`.
@default Infinity
*/
readonly concurrency?: number;
}
}
declare const del: {
/**
Delete files and folders using glob patterns.
@param patterns - See supported minimatch [patterns](https://github.com/isaacs/minimatch#usage).
- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/master/test/test.js)
- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns)
@param options - See the [`glob` options](https://github.com/isaacs/node-glob#options).
@returns A promise for an array of deleted paths.
@example
```
import del = require('del');
(async () => {
const deletedPaths = await del(['tmp/*.js', '!tmp/unicorn.js']);
console.log('Deleted files and folders:\n', deletedPaths.join('\n'));
})();
```
*/
(
patterns: string | ReadonlyArray<string>,
options?: del.Options
): Promise<string[]>;
/**
Synchronously delete files and folders using glob patterns.
@param patterns - See supported minimatch [patterns](https://github.com/isaacs/minimatch#usage).
- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/master/test/test.js)
- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns)
@param options - See the [`glob` options](https://github.com/isaacs/node-glob#options).
@returns An array of deleted paths.
*/
sync(
patterns: string | ReadonlyArray<string>,
options?: del.Options
): string[];
// TODO: Remove this for the next major release
default: typeof del;
};
export = del;