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