1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | import * as fs from "fs";
|
16 | import Stats = fs.Stats;
|
17 |
|
18 | export * from "fs";
|
19 |
|
20 | export function copy(src: string, dest: string, options?: CopyOptions): Promise<void>;
|
21 | export function copy(src: string, dest: string, callback: (err: Error) => void): void;
|
22 | export function copy(src: string, dest: string, options: CopyOptions, callback: (err: Error) => void): void;
|
23 | export function copySync(src: string, dest: string, options?: CopyOptionsSync): void;
|
24 |
|
25 | export function copyFile(src: string, dest: string, flags?: number): Promise<void>;
|
26 | export function copyFile(src: string, dest: string, callback: (err: Error) => void): void;
|
27 | export function copyFile(src: string, dest: string, flags: number, callback: (err: Error) => void): void;
|
28 |
|
29 | export function move(src: string, dest: string, options?: MoveOptions): Promise<void>;
|
30 | export function move(src: string, dest: string, callback: (err: Error) => void): void;
|
31 | export function move(src: string, dest: string, options: MoveOptions, callback: (err: Error) => void): void;
|
32 | export function moveSync(src: string, dest: string, options?: MoveOptions): void;
|
33 |
|
34 | export function createFile(file: string): Promise<void>;
|
35 | export function createFile(file: string, callback: (err: Error) => void): void;
|
36 | export function createFileSync(file: string): void;
|
37 |
|
38 | export function ensureDir(path: string, options?: EnsureOptions | number): Promise<void>;
|
39 | export function ensureDir(path: string, options?: EnsureOptions | number, callback?: (err: Error) => void): void;
|
40 | export function ensureDirSync(path: string, options?: EnsureOptions | number): void;
|
41 |
|
42 | export function mkdirs(dir: string): Promise<void>;
|
43 | export function mkdirs(dir: string, callback: (err: Error) => void): void;
|
44 | export function mkdirp(dir: string): Promise<void>;
|
45 | export function mkdirp(dir: string, callback: (err: Error) => void): void;
|
46 | export function mkdirsSync(dir: string): void;
|
47 | export function mkdirpSync(dir: string): void;
|
48 |
|
49 | export function outputFile(file: string, data: any, options?: WriteFileOptions | string): Promise<void>;
|
50 | export function outputFile(file: string, data: any, callback: (err: Error) => void): void;
|
51 | export function outputFile(file: string, data: any, options: WriteFileOptions | string, callback: (err: Error) => void): void;
|
52 | export function outputFileSync(file: string, data: any, options?: WriteFileOptions | string): void;
|
53 |
|
54 | export function readJson(file: string, options?: ReadOptions): Promise<any>;
|
55 | export function readJson(file: string, callback: (err: Error, jsonObject: any) => void): void;
|
56 | export function readJson(file: string, options: ReadOptions, callback: (err: Error, jsonObject: any) => void): void;
|
57 | export function readJSON(file: string, options?: ReadOptions): Promise<any>;
|
58 | export function readJSON(file: string, callback: (err: Error, jsonObject: any) => void): void;
|
59 | export function readJSON(file: string, options: ReadOptions, callback: (err: Error, jsonObject: any) => void): void;
|
60 |
|
61 | export function readJsonSync(file: string, options?: ReadOptions): any;
|
62 | export function readJSONSync(file: string, options?: ReadOptions): any;
|
63 |
|
64 | export function remove(dir: string): Promise<void>;
|
65 | export function remove(dir: string, callback: (err: Error) => void): void;
|
66 | export function removeSync(dir: string): void;
|
67 |
|
68 | export function outputJSON(file: string, data: any, options?: WriteOptions): Promise<void>;
|
69 | export function outputJSON(file: string, data: any, options: WriteOptions, callback: (err: Error) => void): void;
|
70 | export function outputJSON(file: string, data: any, callback: (err: Error) => void): void;
|
71 | export function outputJson(file: string, data: any, options?: WriteOptions): Promise<void>;
|
72 | export function outputJson(file: string, data: any, options: WriteOptions, callback: (err: Error) => void): void;
|
73 | export function outputJson(file: string, data: any, callback: (err: Error) => void): void;
|
74 | export function outputJsonSync(file: string, data: any, options?: WriteOptions): void;
|
75 | export function outputJSONSync(file: string, data: any, options?: WriteOptions): void;
|
76 |
|
77 | export function writeJSON(file: string, object: any, options?: WriteOptions): Promise<void>;
|
78 | export function writeJSON(file: string, object: any, callback: (err: Error) => void): void;
|
79 | export function writeJSON(file: string, object: any, options: WriteOptions, callback: (err: Error) => void): void;
|
80 | export function writeJson(file: string, object: any, options?: WriteOptions): Promise<void>;
|
81 | export function writeJson(file: string, object: any, callback: (err: Error) => void): void;
|
82 | export function writeJson(file: string, object: any, options: WriteOptions, callback: (err: Error) => void): void;
|
83 |
|
84 | export function writeJsonSync(file: string, object: any, options?: WriteOptions): void;
|
85 | export function writeJSONSync(file: string, object: any, options?: WriteOptions): void;
|
86 |
|
87 | export function ensureFile(path: string): Promise<void>;
|
88 | export function ensureFile(path: string, callback: (err: Error) => void): void;
|
89 | export function ensureFileSync(path: string): void;
|
90 |
|
91 | export function ensureLink(src: string, dest: string): Promise<void>;
|
92 | export function ensureLink(src: string, dest: string, callback: (err: Error) => void): void;
|
93 | export function ensureLinkSync(src: string, dest: string): void;
|
94 |
|
95 | export function ensureSymlink(src: string, dest: string, type?: SymlinkType): Promise<void>;
|
96 | export function ensureSymlink(src: string, dest: string, type: SymlinkType, callback: (err: Error) => void): void;
|
97 | export function ensureSymlink(src: string, dest: string, callback: (err: Error) => void): void;
|
98 | export function ensureSymlinkSync(src: string, dest: string, type?: SymlinkType): void;
|
99 |
|
100 | export function emptyDir(path: string): Promise<void>;
|
101 | export function emptyDir(path: string, callback: (err: Error) => void): void;
|
102 | export function emptyDirSync(path: string): void;
|
103 |
|
104 | export function pathExists(path: string): Promise<boolean>;
|
105 | export function pathExists(path: string, callback: (err: Error, exists: boolean) => void): void;
|
106 | export function pathExistsSync(path: string): boolean;
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
|
112 | export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
113 | export function access(path: string | Buffer, mode?: number): Promise<void>;
|
114 |
|
115 | export function appendFile(file: string | Buffer | number, data: any, options: { encoding?: string; mode?: number | string; flag?: string; },
|
116 | callback: (err: NodeJS.ErrnoException) => void): void;
|
117 | export function appendFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void;
|
118 | export function appendFile(file: string | Buffer | number, data: any, options?: { encoding?: string; mode?: number | string; flag?: string; }): Promise<void>;
|
119 |
|
120 | export function chmod(path: string | Buffer, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void;
|
121 | export function chmod(path: string | Buffer, mode: string | number): Promise<void>;
|
122 |
|
123 | export function chown(path: string | Buffer, uid: number, gid: number): Promise<void>;
|
124 | export function chown(path: string | Buffer, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
125 |
|
126 | export function close(fd: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
127 | export function close(fd: number): Promise<void>;
|
128 |
|
129 | export function fchmod(fd: number, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void;
|
130 | export function fchmod(fd: number, mode: string | number): Promise<void>;
|
131 |
|
132 | export function fchown(fd: number, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
133 | export function fchown(fd: number, uid: number, gid: number): Promise<void>;
|
134 |
|
135 | export function fdatasync(fd: number, callback: () => void): void;
|
136 | export function fdatasync(fd: number): Promise<void>;
|
137 |
|
138 | export function fstat(fd: number, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
139 | export function fstat(fd: number): Promise<Stats>;
|
140 |
|
141 | export function fsync(fd: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
142 | export function fsync(fd: number): Promise<void>;
|
143 |
|
144 | export function ftruncate(fd: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
145 | export function ftruncate(fd: number, len: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
146 | export function ftruncate(fd: number, len?: number): Promise<void>;
|
147 |
|
148 | export function futimes(fd: number, atime: number, mtime: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
149 | export function futimes(fd: number, atime: Date, mtime: Date, callback: (err: NodeJS.ErrnoException) => void): void;
|
150 | export function futimes(fd: number, atime: number, mtime: number): Promise<void>;
|
151 | export function futimes(fd: number, atime: Date, mtime: Date): Promise<void>;
|
152 |
|
153 | export function lchown(path: string | Buffer, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
154 | export function lchown(path: string | Buffer, uid: number, gid: number): Promise<void>;
|
155 |
|
156 | export function link(srcpath: string | Buffer, dstpath: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
|
157 | export function link(srcpath: string | Buffer, dstpath: string | Buffer): Promise<void>;
|
158 |
|
159 | export function lstat(path: string | Buffer, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
160 | export function lstat(path: string | Buffer): Promise<Stats>;
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 | export function mkdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 | export function mkdir(path: string | Buffer, mode: number | string, callback: (err: NodeJS.ErrnoException) => void): void;
|
174 | export function mkdir(path: string | Buffer): Promise<void>;
|
175 |
|
176 | export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void;
|
177 | export function open(path: string | Buffer, flags: string | number, mode: number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void;
|
178 | export function open(path: string | Buffer, flags: string | number, mode?: number): Promise<number>;
|
179 |
|
180 | export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number | null,
|
181 | callback: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
|
182 | export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number | null): Promise<ReadResult>;
|
183 |
|
184 | export function readFile(file: string | Buffer | number, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
185 | export function readFile(file: string | Buffer | number, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
186 | export function readFile(file: string | Buffer | number, options: { flag?: string; } | { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
187 | export function readFile(file: string | Buffer | number, options: { flag?: string; } | { encoding: string; flag?: string; }): Promise<string>;
|
188 |
|
189 | export function readFile(file: string | Buffer | number, encoding: string): Promise<string>;
|
190 | export function readFile(file: string | Buffer | number): Promise<Buffer>;
|
191 |
|
192 | export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void;
|
193 | export function readdir(path: string | Buffer): Promise<string[]>;
|
194 |
|
195 | export function readlink(path: string | Buffer, callback: (err: NodeJS.ErrnoException, linkString: string) => any): void;
|
196 | export function readlink(path: string | Buffer): Promise<string>;
|
197 |
|
198 | export function realpath(path: string | Buffer, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
|
199 | export function realpath(path: string | Buffer, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
|
200 | export function realpath(path: string | Buffer, cache?: { [path: string]: string }): Promise<string>;
|
201 |
|
202 | export function rename(oldPath: string, newPath: string, callback: (err: NodeJS.ErrnoException) => void): void;
|
203 | export function rename(oldPath: string, newPath: string): Promise<void>;
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 | export function rmdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
|
211 | export function rmdir(path: string | Buffer): Promise<void>;
|
212 |
|
213 | export function stat(path: string | Buffer, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
214 | export function stat(path: string | Buffer): Promise<Stats>;
|
215 |
|
216 | export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type: FsSymlinkType | undefined, callback: (err: NodeJS.ErrnoException) => void): void;
|
217 | export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
|
218 | export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type?: FsSymlinkType): Promise<void>;
|
219 |
|
220 | export function truncate(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
|
221 | export function truncate(path: string | Buffer, len: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
222 | export function truncate(path: string | Buffer, len?: number): Promise<void>;
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 | export function unlink(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
|
230 | export function unlink(path: string | Buffer): Promise<void>;
|
231 |
|
232 | export function utimes(path: string | Buffer, atime: number, mtime: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
233 | export function utimes(path: string | Buffer, atime: Date, mtime: Date, callback: (err: NodeJS.ErrnoException) => void): void;
|
234 | export function utimes(path: string | Buffer, atime: number, mtime: number): Promise<void>;
|
235 | export function utimes(path: string | Buffer, atime: Date, mtime: Date): Promise<void>;
|
236 |
|
237 | export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number | null, callback: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
|
238 | export function write(fd: number, buffer: Buffer, offset: number, length: number, callback: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
|
239 | export function write(fd: number, data: any, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
|
240 | export function write(fd: number, data: any, offset: number, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
|
241 | export function write(fd: number, data: any, offset: number, encoding: string, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
|
242 | export function write(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number | null): Promise<WriteResult>;
|
243 | export function write(fd: number, data: any, offset?: number, encoding?: string): Promise<WriteResult>;
|
244 |
|
245 | export function writeFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void;
|
246 | export function writeFile(file: string | Buffer | number, data: any, options?: WriteFileOptions | string): Promise<void>;
|
247 | export function writeFile(file: string | Buffer | number, data: any, options: WriteFileOptions | string, callback: (err: NodeJS.ErrnoException) => void): void;
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 | export function mkdtemp(prefix: string): Promise<string>;
|
255 | export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException, folder: string) => void): void;
|
256 |
|
257 | export interface PathEntry {
|
258 | path: string;
|
259 | stats: Stats;
|
260 | }
|
261 |
|
262 | export interface PathEntryStream {
|
263 | read(): PathEntry | null;
|
264 | }
|
265 |
|
266 | export type CopyFilterSync = (src: string, dest: string) => boolean;
|
267 | export type CopyFilterAsync = (src: string, dest: string) => Promise<boolean>;
|
268 |
|
269 | export type SymlinkType = "dir" | "file";
|
270 | export type FsSymlinkType = "dir" | "file" | "junction";
|
271 |
|
272 | export interface CopyOptions {
|
273 | dereference?: boolean;
|
274 | overwrite?: boolean;
|
275 | preserveTimestamps?: boolean;
|
276 | errorOnExist?: boolean;
|
277 | filter?: CopyFilterSync | CopyFilterAsync;
|
278 | recursive?: boolean;
|
279 | }
|
280 |
|
281 | export interface CopyOptionsSync extends CopyOptions {
|
282 | filter?: CopyFilterSync;
|
283 | }
|
284 |
|
285 | export interface EnsureOptions {
|
286 | mode?: number;
|
287 | }
|
288 |
|
289 | export interface MoveOptions {
|
290 | overwrite?: boolean;
|
291 | limit?: number;
|
292 | }
|
293 |
|
294 | export interface ReadOptions {
|
295 | throws?: boolean;
|
296 | fs?: object;
|
297 | reviver?: any;
|
298 | encoding?: string;
|
299 | flag?: string;
|
300 | }
|
301 |
|
302 | export interface WriteFileOptions {
|
303 | encoding?: string;
|
304 | flag?: string;
|
305 | mode?: number;
|
306 | }
|
307 |
|
308 | export interface WriteOptions extends WriteFileOptions {
|
309 | fs?: object;
|
310 | replacer?: any;
|
311 | spaces?: number | string;
|
312 | EOL?: string;
|
313 | }
|
314 |
|
315 | export interface ReadResult {
|
316 | bytesRead: number;
|
317 | buffer: Buffer;
|
318 | }
|
319 |
|
320 | export interface WriteResult {
|
321 | bytesWritten: number;
|
322 | buffer: Buffer;
|
323 | }
|