UNPKG

2.7 kBTypeScriptView Raw
1// Type definitions for memory-fs 0.3.0
2// Project: https://github.com/webpack/memory-fs
3// Definitions by: e-cloud <https://github.com/e-cloud>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5// TypeScript Version: 3.7
6
7/// <reference types="node" />
8
9declare class MemoryFileSystem {
10 data: any;
11
12 constructor(data?: any);
13
14 meta(_path: string): any;
15
16 existsSync(_path: string): boolean;
17
18 statSync(_path: string): {
19 isFile: () => boolean;
20 isDirectory: () => boolean;
21 isBlockDevice: () => boolean;
22 isCharacterDevice: () => boolean;
23 isSymbolicLink: () => boolean;
24 isFIFO: () => boolean;
25 isSocket: () => boolean;
26 };
27
28 readFileSync(_path: string, encoding?: string): any;
29
30 readdirSync(_path: string): string[];
31
32 mkdirpSync(_path: string): void;
33
34 mkdirSync(_path: string): void;
35
36 _remove(_path: string, name: string, testFn: ((part: string) => boolean)): void;
37
38 rmdirSync(_path: string): void;
39
40 unlinkSync(_path: string): void;
41
42 readlinkSync(_path: string): string;
43
44 writeFileSync(_path: string, content: string | Buffer, encoding?: string): void;
45
46 createReadStream(
47 path: string, options?: {
48 start: number;
49 end: number;
50 }
51 ): any;
52
53 createWriteStream(path: string, options?: any): any;
54
55 exists(path: string, callback: (isExist: boolean) => void): void;
56
57 writeFile(path: string, content: string | Buffer, callback: (err: Error | undefined) => void): void;
58
59 writeFile(path: string, content: string | Buffer, encoding: string, callback: (err: Error | undefined) => void): 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;
87
\No newline at end of file