/
proxies.ts
72 lines (62 loc) · 1.59 KB
/
proxies.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
import * as fs from 'fs-extra';
import { MoveOptions, WriteFileOptions } from 'fs-extra';
// istanbul ignore next
export function stat(path: string | Buffer): Promise<fs.Stats> {
return fs.stat(path);
}
// istanbul ignore next
export function chmod(
path: string | Buffer,
mode: string | number
): Promise<void> {
return fs.chmod(path, mode);
}
export async function readFile(fileName: string): Promise<Buffer>;
export async function readFile(
fileName: string,
encoding: 'utf8'
): Promise<string>;
export async function readFile(
fileName: string,
encoding?: string
): Promise<string | Buffer> {
return fs.readFile(fileName, encoding);
}
// istanbul ignore next
export async function writeFile(
fileName: string,
fileContent: string
): Promise<void> {
return fs.writeFile(fileName, fileContent);
}
// istanbul ignore next
export async function outputFile(
file: string,
data: any,
options?: WriteFileOptions | string
): Promise<void> {
return fs.outputFile(file, data, options);
}
export async function remove(dir: string): Promise<void> {
return fs.remove(dir);
}
// istanbul ignore next
export async function unlink(path: string | Buffer): Promise<void> {
return fs.unlink(path);
}
// istanbul ignore next
export async function exists(path: string): Promise<boolean> {
return fs.pathExists(path);
}
// istanbul ignore next
export async function pathExists(path: string): Promise<boolean> {
return fs.pathExists(path);
}
// istanbul ignore next
export function move(
src: string,
dest: string,
options?: MoveOptions
): Promise<void> {
return fs.move(src, dest, options);
}