1 |
|
2 | import * as _fs from 'fs';
|
3 | declare function copy(src: string, dist: string, opts?: {
|
4 |
|
5 | skip?: (file: string, stat: _fs.Stats) => Promise<boolean | void> | boolean | void;
|
6 |
|
7 | override?: boolean;
|
8 | }): Promise<void>;
|
9 | export declare type WatchDirHandler = (event: string, filename: string) => void;
|
10 | export declare type WatchDirOptions = {
|
11 | persistent?: boolean;
|
12 |
|
13 | throttle?: number;
|
14 | };
|
15 | declare function watchDir(dir: string, cb: WatchDirHandler): void;
|
16 | declare function watchDir(dir: string, options: WatchDirOptions, cb: WatchDirHandler): void;
|
17 | export declare const fs: {
|
18 | access: typeof _fs.access.__promisify__;
|
19 | open: typeof _fs.open.__promisify__;
|
20 | rename: typeof _fs.rename.__promisify__;
|
21 | truncate: typeof _fs.truncate.__promisify__;
|
22 | rmdir: typeof _fs.rmdir.__promisify__;
|
23 | mkdir: typeof _fs.mkdir.__promisify__;
|
24 | readdir: typeof _fs.readdir.__promisify__;
|
25 | readlink: typeof _fs.readlink.__promisify__;
|
26 | symlink: typeof _fs.symlink.__promisify__;
|
27 | lstat: typeof _fs.lstat.__promisify__;
|
28 | stat: typeof _fs.stat.__promisify__;
|
29 | link: (arg1: _fs.PathLike, arg2: _fs.PathLike) => Promise<void>;
|
30 | unlink: typeof _fs.unlink.__promisify__;
|
31 | chmod: typeof _fs.chmod.__promisify__;
|
32 | chown: typeof _fs.chown.__promisify__;
|
33 | utimes: typeof _fs.utimes.__promisify__;
|
34 | realpath: typeof _fs.realpath.__promisify__;
|
35 | mkdtemp: typeof _fs.mkdtemp.__promisify__;
|
36 | writeFile: typeof _fs.writeFile.__promisify__;
|
37 | appendFile: typeof _fs.appendFile.__promisify__;
|
38 | readFile: typeof _fs.readFile.__promisify__;
|
39 | existsSync: typeof _fs.existsSync;
|
40 | createReadString: typeof _fs.createReadStream;
|
41 | createWriteStream: typeof _fs.createWriteStream;
|
42 | constants: typeof _fs.constants;
|
43 | watchDir: typeof watchDir;
|
44 | copy: typeof copy;
|
45 | exists(path: _fs.PathLike): Promise<boolean>;
|
46 |
|
47 | lexists(path: _fs.PathLike): Promise<boolean>;
|
48 | isFile(path: _fs.PathLike): Promise<boolean>;
|
49 | isDirectory(path: _fs.PathLike): Promise<boolean>;
|
50 | isSymbolicLink(path: _fs.PathLike): Promise<boolean>;
|
51 | copyFile: typeof _fs.copyFile.__promisify__ | ((src: _fs.PathLike, dist: _fs.PathLike) => Promise<{}>);
|
52 | /**
|
53 | * Make directory with parents, like `mkdir -p`
|
54 | * @param dir
|
55 | */
|
56 | mkdirp(dir: string): Promise<void>;
|
57 | /**
|
58 | * Make directory with parents, like `mkdir -p`
|
59 | * @param dir
|
60 | */
|
61 | mkdirpSync(dir: string): void;
|
62 | /**
|
63 | * Remove file or directory recursively, like `rm -rf`
|
64 | * @param path The path to remove
|
65 | * @param opts Options
|
66 | */
|
67 | rmrf(path: string): Promise<void>;
|
68 | outputFile(path: string, data: any, options?: string | {
|
69 | encoding?: string | null | undefined;
|
70 | mode?: string | number | undefined;
|
71 | flag?: string | undefined;
|
72 | } | null | undefined): Promise<void>;
|
73 | outputFileSync(path: string, data: any, options?: string | {
|
74 | encoding?: string | null | undefined;
|
75 | mode?: string | number | undefined;
|
76 | flag?: string | undefined;
|
77 | } | null | undefined): void;
|
78 | outputJson(path: string, data: object, options?: string | {
|
79 | encoding?: string | null | undefined;
|
80 | mode?: string | number | undefined;
|
81 | flag?: string | undefined;
|
82 | space?: number | undefined;
|
83 | replacer?: ((key: string, value: any) => any) | undefined;
|
84 | } | null | undefined): Promise<void>;
|
85 | outputJsonSync(path: string, data: any, options?: string | {
|
86 | encoding?: string | null | undefined;
|
87 | mode?: string | number | undefined;
|
88 | flag?: string | undefined;
|
89 | space?: number | undefined;
|
90 | replacer?: ((key: string, value: any) => any) | undefined;
|
91 | } | null | undefined): void;
|
92 | readJson<T = any>(path: string, options?: {
|
93 | encoding?: null | undefined;
|
94 | flag?: string | undefined;
|
95 | } | null | undefined): Promise<T>;
|
96 | readJsonSync<T = any>(path: string, options?: {
|
97 | encoding?: null | undefined;
|
98 | flag?: string | undefined;
|
99 | } | null | undefined): T;
|
100 | iter(dir: string, skip: (path: string, stat: _fs.Stats) => boolean | void | Promise<boolean | void>): Promise<void>;
|
101 | renameSync(oldPath: _fs.PathLike, newPath: _fs.PathLike): void;
|
102 | truncateSync(path: _fs.PathLike, len?: number | null | undefined): void;
|
103 | ftruncate: typeof _fs.ftruncate;
|
104 | ftruncateSync(fd: number, len?: number | null | undefined): void;
|
105 | chownSync(path: _fs.PathLike, uid: number, gid: number): void;
|
106 | fchown: typeof _fs.fchown;
|
107 | fchownSync(fd: number, uid: number, gid: number): void;
|
108 | lchown: typeof _fs.lchown;
|
109 | lchownSync(path: _fs.PathLike, uid: number, gid: number): void;
|
110 | chmodSync(path: _fs.PathLike, mode: string | number): void;
|
111 | fchmod: typeof _fs.fchmod;
|
112 | fchmodSync(fd: number, mode: string | number): void;
|
113 | lchmod: typeof _fs.lchmod;
|
114 | lchmodSync(path: _fs.PathLike, mode: string | number): void;
|
115 | statSync(path: _fs.PathLike): _fs.Stats;
|
116 | fstat: typeof _fs.fstat;
|
117 | fstatSync(fd: number): _fs.Stats;
|
118 | lstatSync(path: _fs.PathLike): _fs.Stats;
|
119 | linkSync(existingPath: _fs.PathLike, newPath: _fs.PathLike): void;
|
120 | symlinkSync(target: _fs.PathLike, path: _fs.PathLike, type?: "dir" | "file" | "junction" | null | undefined): void;
|
121 | readlinkSync(path: _fs.PathLike, options?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | {
|
122 | encoding?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | null | undefined;
|
123 | } | null | undefined): string;
|
124 | readlinkSync(path: _fs.PathLike, options: "buffer" | {
|
125 | encoding: "buffer";
|
126 | }): Buffer;
|
127 | readlinkSync(path: _fs.PathLike, options?: string | {
|
128 | encoding?: string | null | undefined;
|
129 | } | null | undefined): string | Buffer;
|
130 | realpathSync: typeof _fs.realpathSync;
|
131 | unlinkSync(path: _fs.PathLike): void;
|
132 | rmdirSync(path: _fs.PathLike): void;
|
133 | mkdirSync(path: _fs.PathLike, options?: string | number | _fs.MakeDirectoryOptions | null | undefined): void;
|
134 | mkdtempSync(prefix: string, options?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | {
|
135 | encoding?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | null | undefined;
|
136 | } | null | undefined): string;
|
137 | mkdtempSync(prefix: string, options: "buffer" | {
|
138 | encoding: "buffer";
|
139 | }): Buffer;
|
140 | mkdtempSync(prefix: string, options?: string | {
|
141 | encoding?: string | null | undefined;
|
142 | } | null | undefined): string | Buffer;
|
143 | readdirSync(path: _fs.PathLike, options?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | {
|
144 | encoding: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | null;
|
145 | withFileTypes?: false | undefined;
|
146 | } | null | undefined): string[];
|
147 | readdirSync(path: _fs.PathLike, options: "buffer" | {
|
148 | encoding: "buffer";
|
149 | withFileTypes?: false | undefined;
|
150 | }): Buffer[];
|
151 | readdirSync(path: _fs.PathLike, options?: string | {
|
152 | encoding?: string | null | undefined;
|
153 | withFileTypes?: false | undefined;
|
154 | } | null | undefined): string[] | Buffer[];
|
155 | readdirSync(path: _fs.PathLike, options: {
|
156 | withFileTypes: true;
|
157 | }): _fs.Dirent[];
|
158 | close: typeof _fs.close;
|
159 | closeSync(fd: number): void;
|
160 | openSync(path: _fs.PathLike, flags: string | number, mode?: string | number | null | undefined): number;
|
161 | utimesSync(path: _fs.PathLike, atime: string | number | Date, mtime: string | number | Date): void;
|
162 | futimes: typeof _fs.futimes;
|
163 | futimesSync(fd: number, atime: string | number | Date, mtime: string | number | Date): void;
|
164 | fsync: typeof _fs.fsync;
|
165 | fsyncSync(fd: number): void;
|
166 | write: typeof _fs.write;
|
167 | writeSync(fd: number, buffer: _fs.BinaryData, offset?: number | null | undefined, length?: number | null | undefined, position?: number | null | undefined): number;
|
168 | writeSync(fd: number, string: any, position?: number | null | undefined, encoding?: string | null | undefined): number;
|
169 | read: typeof _fs.read;
|
170 | readSync(fd: number, buffer: _fs.BinaryData, offset: number, length: number, position: number | null): number;
|
171 | readFileSync(path: string | number | Buffer | import("url").URL, options?: {
|
172 | encoding?: null | undefined;
|
173 | flag?: string | undefined;
|
174 | } | null | undefined): Buffer;
|
175 | readFileSync(path: string | number | Buffer | import("url").URL, options: string | {
|
176 | encoding: string;
|
177 | flag?: string | undefined;
|
178 | }): string;
|
179 | readFileSync(path: string | number | Buffer | import("url").URL, options?: string | {
|
180 | encoding?: string | null | undefined;
|
181 | flag?: string | undefined;
|
182 | } | null | undefined): string | Buffer;
|
183 | writeFileSync(path: string | number | Buffer | import("url").URL, data: any, options?: string | {
|
184 | encoding?: string | null | undefined;
|
185 | mode?: string | number | undefined;
|
186 | flag?: string | undefined;
|
187 | } | null | undefined): void;
|
188 | appendFileSync(file: string | number | Buffer | import("url").URL, data: any, options?: string | {
|
189 | encoding?: string | null | undefined;
|
190 | mode?: string | number | undefined;
|
191 | flag?: string | undefined;
|
192 | } | null | undefined): void;
|
193 | watchFile(filename: _fs.PathLike, options: {
|
194 | persistent?: boolean | undefined;
|
195 | interval?: number | undefined;
|
196 | } | undefined, listener: (curr: _fs.Stats, prev: _fs.Stats) => void): void;
|
197 | watchFile(filename: _fs.PathLike, listener: (curr: _fs.Stats, prev: _fs.Stats) => void): void;
|
198 | unwatchFile(filename: _fs.PathLike, listener?: ((curr: _fs.Stats, prev: _fs.Stats) => void) | undefined): void;
|
199 | watch(filename: _fs.PathLike, options: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | {
|
200 | encoding?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex" | null | undefined;
|
201 | persistent?: boolean | undefined;
|
202 | recursive?: boolean | undefined;
|
203 | } | null | undefined, listener?: ((event: string, filename: string) => void) | undefined): _fs.FSWatcher;
|
204 | watch(filename: _fs.PathLike, options: "buffer" | {
|
205 | encoding: "buffer";
|
206 | persistent?: boolean | undefined;
|
207 | recursive?: boolean | undefined;
|
208 | }, listener?: ((event: string, filename: Buffer) => void) | undefined): _fs.FSWatcher;
|
209 | watch(filename: _fs.PathLike, options: string | {
|
210 | encoding?: string | null | undefined;
|
211 | persistent?: boolean | undefined;
|
212 | recursive?: boolean | undefined;
|
213 | } | null, listener?: ((event: string, filename: string | Buffer) => void) | undefined): _fs.FSWatcher;
|
214 | watch(filename: _fs.PathLike, listener?: ((event: string, filename: string) => any) | undefined): _fs.FSWatcher;
|
215 | accessSync(path: _fs.PathLike, mode?: number | undefined): void;
|
216 | createReadStream(path: _fs.PathLike, options?: string | {
|
217 | flags?: string | undefined;
|
218 | encoding?: string | undefined;
|
219 | fd?: number | undefined;
|
220 | mode?: number | undefined;
|
221 | autoClose?: boolean | undefined;
|
222 | start?: number | undefined;
|
223 | end?: number | undefined;
|
224 | highWaterMark?: number | undefined;
|
225 | } | undefined): _fs.ReadStream;
|
226 | fdatasync: typeof _fs.fdatasync;
|
227 | fdatasyncSync(fd: number): void;
|
228 | copyFileSync(src: _fs.PathLike, dest: _fs.PathLike, flags?: number | undefined): void;
|
229 | Stats: typeof _fs.Stats;
|
230 | Dirent: typeof _fs.Dirent;
|
231 | ReadStream: typeof _fs.ReadStream;
|
232 | WriteStream: typeof _fs.WriteStream;
|
233 | promises: typeof _fs.promises;
|
234 | };
|
235 | export {};
|
236 |
|
\ | No newline at end of file |