UNPKG

2.5 kBTypeScriptView Raw
1/// <reference types="node" />
2
3declare class MemoryFileSystem {
4 data: any;
5
6 constructor(data?: any);
7
8 meta(_path: string): any;
9
10 existsSync(_path: string): boolean;
11
12 statSync(_path: string): {
13 isFile: () => boolean;
14 isDirectory: () => boolean;
15 isBlockDevice: () => boolean;
16 isCharacterDevice: () => boolean;
17 isSymbolicLink: () => boolean;
18 isFIFO: () => boolean;
19 isSocket: () => boolean;
20 };
21
22 readFileSync(_path: string, encoding?: string): any;
23
24 readdirSync(_path: string): string[];
25
26 mkdirpSync(_path: string): void;
27
28 mkdirSync(_path: string): void;
29
30 _remove(_path: string, name: string, testFn: (part: string) => boolean): void;
31
32 rmdirSync(_path: string): void;
33
34 unlinkSync(_path: string): void;
35
36 readlinkSync(_path: string): string;
37
38 writeFileSync(_path: string, content: string | Buffer, encoding?: string): void;
39
40 createReadStream(
41 path: string,
42 options?: {
43 start: number;
44 end: number;
45 },
46 ): any;
47
48 createWriteStream(path: string, options?: any): any;
49
50 exists(path: string, callback: (isExist: boolean) => void): void;
51
52 writeFile(path: string, content: string | Buffer, callback: (err: Error | undefined) => void): void;
53
54 writeFile(
55 path: string,
56 content: string | Buffer,
57 encoding: string,
58 callback: (err: Error | undefined) => void,
59 ): void;
60
61 join(path: string, request: string): string;
62
63 pathToArray(path: string): string[];
64
65 normalize(path: string): string;
66
67 stat(path: string, callback: (err: Error | null, result?: any) => void): void;
68
69 readdir(path: string, callback: (err: Error | null, result?: any) => void): void;
70
71 mkdirp(path: string, callback: (err: Error | null, result?: any) => void): void;
72
73 rmdir(path: string, callback: (err: Error | null, result?: any) => void): void;
74
75 unlink(path: string, callback: (err: Error | null, result?: any) => void): void;
76
77 readlink(path: string, callback: (err: Error | null, result?: any) => void): void;
78
79 mkdir(path: string, callback: (err: Error | null) => void): void;
80 mkdir(path: string, optArg: {}, callback: (err: Error | null, result?: any) => void): void;
81
82 readFile(path: string, callback: (err: Error | null, result?: any) => void): void;
83 readFile(path: string, optArg: {}, callback: (err: Error | null, result?: any) => void): void;
84}
85
86export = MemoryFileSystem;