-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.d.ts
82 lines (75 loc) · 1.87 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
79
80
81
82
export = parser;
export as namespace parser;
declare var parser: parser.Parser;
declare namespace parser {
interface Parser {
/**
* parser() main method
* @param dirPath { string }
* @param ptions { Options }
*/
(dirPath: string, ptions: Options): Promise<Parsed>
}
/**
* options of dirparse
*/
interface Options {
depth?: number;
reverse?: boolean;
fileFirst?: boolean;
fileOnly?: boolean;
dirOnly?: boolean;
getFiles?: boolean;
getChildren?: boolean;
dirTree?: boolean; // default: true
dirInfo?: boolean; // default: true
lineType?: 'solid' | 'dash' | 'dashed'; // default: 'solid'
excludes?: Array<string>; // eg: [ '.git', 'node_modules', '.idea' ];
excPaths?: Array<string>; // eg: [ 'src/app' ];
excPatterns?: Array<string>; // eg: [ 'src/*.js ]';
ignores: Array<string>; // eg: [ 'public' ];
includes: Array<string>; // eg: [ 'app.js' ];
paths?: Array<string>; // eg: [ 'src/public' ];
patterns?: Array<string>; // eg: [ '*.js' ]';
glob?: string; // eg: '**/*.js';
}
/**
* the pased result.
*/
interface Parsed extends DirInfo {
dirTree: string;
children: Array<DirInfo | FileInfo>
files: Array<FileInfo>
}
/**
* field of directory info.
*/
interface DirInfo {
name: string;
type: 'directory';
size: number;
size_kb: number;
path: string;
absPath: string;
dir: string;
absDir: string;
dirNum: number;
fileNum: number;
children: Array<DirInfo | FileInfo>
}
/**
* field of file info.
*/
interface FileInfo {
name: string;
base: string;
ext: string;
type: 'file';
size: number;
size_kb: number;
path: string;
absPath: string;
dir: string;
absDir: string;
}
}