-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
78 lines (56 loc) · 1.88 KB
/
index.d.ts
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
import {Stats} from "fs";
declare class ExpireEntry {
constructor({ async, path, parent }: { async?: boolean, path: string, parent: ExpireEntry | null })
readonly path: string;
readonly basename: string;
readonly isDir: boolean;
readonly isRoot: boolean;
readonly size: number;
readonly stats: Stats;
readonly parent: ExpireEntry | null;
readonly children: Map<string, ExpireEntry>;
readonly childrenList: string[];
readonly hasChildren: boolean;
readonly childrenValues: ExpireEntry[];
getTime(type: 'atime' | 'mtime' | 'ctime' | 'birthtime'): number;
populate(): Promise<void>;
delete({ keepEmptyParent, dry, removeRoot }?: { keepEmptyParent: boolean, dry: boolean, removeRoot: boolean }): Promise<void>;
traverse(cb: (e: ExpireEntry) => any): void;
traverseAsync(cb: (e: ExpireEntry) => Promise<any>): Promise<void>;
list(): ExpireEntry[]
}
interface ExpireFSConstructorOptions {
folder: string
unsafe?: boolean,
timeType?: 'atime' | 'mtime' | 'ctime' | 'birthtime'
filter?: RegExp
expire?: number
pressure?: number
minimumAge?: number
interval?: number
autoStart?: boolean,
removeEmptyDirs?: boolean,
removeCleanedDirs?: boolean,
removeRoot?: boolean,
async?: boolean,
dry?: boolean,
}
declare class ExpireFS {
private _shouldDelete(path: string, stats: Stats): boolean;
private _expire({ entry, dry }: { entry: ExpireEntry, dry?: boolean }): Promise<ExpireEntry>;
private _pressure({ entry, dry }: { entry: ExpireEntry, dry?: boolean }): Promise<ExpireEntry>;
constructor(props: ExpireFSConstructorOptions);
list(): Promise<ExpireEntry>;
clean({ dry }?: { dry: boolean }): Promise<ExpireEntry[]>;
stop(): boolean;
start(): boolean;
}
declare namespace ExpireFS {
const TimeType: {
access_time: 'atime',
modify_time: 'mtime',
creation_time: 'ctime',
birth_time: 'birthtime'
}
}
export = ExpireFS