@homedev/files 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +56 -0
- package/package.json +1 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const exists: (fileName: string) => Promise<boolean>;
|
|
2
|
+
|
|
3
|
+
declare interface FilePatternOptions {
|
|
4
|
+
cwd: string;
|
|
5
|
+
filter?: (fileName: string, index: number, array: string[]) => boolean;
|
|
6
|
+
map: (fileName: string, index: number, array: string[]) => Promise<any>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export declare const globMap: <T>(pattern: string | string[], options: FilePatternOptions) => Promise<T[] | T>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
* @param fileName
|
|
14
|
+
* @param options
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
export declare const loadFormat: <T = any>(fileName: string, options?: LoadOptions) => Promise<LoadResult<T>>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare interface LoadOptions {
|
|
23
|
+
dirs?: string[];
|
|
24
|
+
parsers?: Record<string, (data: string) => any>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export declare interface LoadResult<T> {
|
|
28
|
+
fullPath: string;
|
|
29
|
+
folderPath: string;
|
|
30
|
+
content: T;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export declare const locate: (fileName: string, dirs?: string[]) => Promise<string>;
|
|
34
|
+
|
|
35
|
+
export declare interface Output {
|
|
36
|
+
name: string;
|
|
37
|
+
type?: 'json' | 'yaml' | 'text';
|
|
38
|
+
value: any;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export declare const writeFormat: (filePath: string, content: any, format?: "yaml" | "json" | "text") => Promise<void>;
|
|
42
|
+
|
|
43
|
+
export declare const writeOutput: (o: Output, options?: WriteOutputOption) => Promise<void>;
|
|
44
|
+
|
|
45
|
+
export declare interface WriteOutputOption {
|
|
46
|
+
targetDirectory?: string;
|
|
47
|
+
writing?: (output: Output) => boolean | undefined | void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export declare const writeOutputs: (outputs: Output[], options?: WriteOutputsOption) => Promise<void>;
|
|
51
|
+
|
|
52
|
+
export declare interface WriteOutputsOption extends WriteOutputOption {
|
|
53
|
+
removeFirst?: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { }
|