1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | import stream = require("stream");
|
12 |
|
13 | export interface Stats {
|
14 | isFile(): boolean;
|
15 | isDirectory(): boolean;
|
16 | isBlockDevice(): boolean;
|
17 | isCharacterDevice(): boolean;
|
18 | isSymbolicLink(): boolean;
|
19 | isFIFO(): boolean;
|
20 | isSocket(): boolean;
|
21 | dev: number;
|
22 | ino: number;
|
23 | mode: number;
|
24 | nlink: number;
|
25 | uid: number;
|
26 | gid: number;
|
27 | rdev: number;
|
28 | size: number;
|
29 | blksize: number;
|
30 | blocks: number;
|
31 | atime: Date;
|
32 | mtime: Date;
|
33 | ctime: Date;
|
34 | }
|
35 |
|
36 | export interface FSWatcher {
|
37 | close(): void;
|
38 | }
|
39 |
|
40 | export declare class ReadStream extends stream.Readable { }
|
41 | export declare class WriteStream extends stream.Writable { }
|
42 |
|
43 |
|
44 | export declare function copy(src: string, dest: string, callback?: (err: Error) => void): void;
|
45 | export declare function copy(src: string, dest: string, filter: CopyFilter, callback?: (err: Error) => void): void;
|
46 | export declare function copy(src: string, dest: string, options: CopyOptions, callback?: (err: Error) => void): void;
|
47 |
|
48 | export declare function copySync(src: string, dest: string): void;
|
49 | export declare function copySync(src: string, dest: string, filter: CopyFilter): void;
|
50 | export declare function copySync(src: string, dest: string, options: CopyOptions): void;
|
51 |
|
52 | export declare function createFile(file: string, callback?: (err: Error) => void): void;
|
53 | export declare function createFileSync(file: string): void;
|
54 |
|
55 | export declare function mkdirs(dir: string, callback?: (err: Error) => void): void;
|
56 | export declare function mkdirp(dir: string, callback?: (err: Error) => void): void;
|
57 | export declare function mkdirs(dir: string, options?: MkdirOptions, callback?: (err: Error) => void): void;
|
58 | export declare function mkdirp(dir: string, options?: MkdirOptions, callback?: (err: Error) => void): void;
|
59 | export declare function mkdirsSync(dir: string, options?: MkdirOptions): void;
|
60 | export declare function mkdirpSync(dir: string, options?: MkdirOptions): void;
|
61 |
|
62 | export declare function outputFile(file: string, data: any, callback?: (err: Error) => void): void;
|
63 | export declare function outputFileSync(file: string, data: any): void;
|
64 |
|
65 | export declare function outputJson(file: string, data: any, callback?: (err: Error) => void): void;
|
66 | export declare function outputJSON(file: string, data: any, callback?: (err: Error) => void): void;
|
67 | export declare function outputJsonSync(file: string, data: any): void;
|
68 | export declare function outputJSONSync(file: string, data: any): void;
|
69 |
|
70 | export declare function readJson(file: string, callback: (err: Error, jsonObject: any) => void): void;
|
71 | export declare function readJson(file: string, options: OpenOptions, callback: (err: Error, jsonObject: any) => void): void;
|
72 | export declare function readJSON(file: string, callback: (err: Error, jsonObject: any) => void): void;
|
73 | export declare function readJSON(file: string, options: OpenOptions, callback: (err: Error, jsonObject: any) => void): void;
|
74 |
|
75 | export declare function readJsonSync(file: string, options?: OpenOptions): any;
|
76 | export declare function readJSONSync(file: string, options?: OpenOptions): any;
|
77 |
|
78 | export declare function remove(dir: string, callback?: (err: Error) => void): void;
|
79 | export declare function removeSync(dir: string): void;
|
80 |
|
81 |
|
82 |
|
83 | export declare function writeJson(file: string, object: any, callback?: (err: Error) => void): void;
|
84 | export declare function writeJson(file: string, object: any, options?: OpenOptions, callback?: (err: Error) => void): void;
|
85 | export declare function writeJSON(file: string, object: any, callback?: (err: Error) => void): void;
|
86 | export declare function writeJSON(file: string, object: any, options?: OpenOptions, callback?: (err: Error) => void): void;
|
87 |
|
88 | export declare function writeJsonSync(file: string, object: any, options?: OpenOptions): void;
|
89 | export declare function writeJSONSync(file: string, object: any, options?: OpenOptions): void;
|
90 |
|
91 | export declare function rename(oldPath: string, newPath: string, callback?: (err: Error) => void): void;
|
92 | export declare function renameSync(oldPath: string, newPath: string): void;
|
93 | export declare function truncate(fd: number, len: number, callback?: (err: Error) => void): void;
|
94 | export declare function truncateSync(fd: number, len: number): void;
|
95 | export declare function chown(path: string, uid: number, gid: number, callback?: (err: Error) => void): void;
|
96 | export declare function chownSync(path: string, uid: number, gid: number): void;
|
97 | export declare function fchown(fd: number, uid: number, gid: number, callback?: (err: Error) => void): void;
|
98 | export declare function fchownSync(fd: number, uid: number, gid: number): void;
|
99 | export declare function lchown(path: string, uid: number, gid: number, callback?: (err: Error) => void): void;
|
100 | export declare function lchownSync(path: string, uid: number, gid: number): void;
|
101 | export declare function chmod(path: string, mode: number, callback?: (err: Error) => void): void;
|
102 | export declare function chmod(path: string, mode: string, callback?: (err: Error) => void): void;
|
103 | export declare function chmodSync(path: string, mode: number): void;
|
104 | export declare function chmodSync(path: string, mode: string): void;
|
105 | export declare function fchmod(fd: number, mode: number, callback?: (err: Error) => void): void;
|
106 | export declare function fchmod(fd: number, mode: string, callback?: (err: Error) => void): void;
|
107 | export declare function fchmodSync(fd: number, mode: number): void;
|
108 | export declare function fchmodSync(fd: number, mode: string): void;
|
109 | export declare function lchmod(path: string, mode: string, callback?: (err: Error) => void): void;
|
110 | export declare function lchmod(path: string, mode: number, callback?: (err: Error) => void): void;
|
111 | export declare function lchmodSync(path: string, mode: number): void;
|
112 | export declare function lchmodSync(path: string, mode: string): void;
|
113 | export declare function stat(path: string, callback?: (err: Error, stats: Stats) => void): void;
|
114 | export declare function lstat(path: string, callback?: (err: Error, stats: Stats) => void): void;
|
115 | export declare function fstat(fd: number, callback?: (err: Error, stats: Stats) => void): void;
|
116 | export declare function statSync(path: string): Stats;
|
117 | export declare function lstatSync(path: string): Stats;
|
118 | export declare function fstatSync(fd: number): Stats;
|
119 | export declare function link(srcpath: string, dstpath: string, callback?: (err: Error) => void): void;
|
120 | export declare function linkSync(srcpath: string, dstpath: string): void;
|
121 | export declare function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err: Error) => void): void;
|
122 | export declare function symlinkSync(srcpath: string, dstpath: string, type?: string): void;
|
123 | export declare function readlink(path: string, callback?: (err: Error, linkString: string) => void): void;
|
124 | export declare function realpath(path: string, callback?: (err: Error, resolvedPath: string) => void): void;
|
125 | export declare function realpath(path: string, cache: string, callback: (err: Error, resolvedPath: string) => void): void;
|
126 | export declare function realpathSync(path: string, cache?: boolean): string;
|
127 | export declare function unlink(path: string, callback?: (err: Error) => void): void;
|
128 | export declare function unlinkSync(path: string): void;
|
129 | export declare function rmdir(path: string, callback?: (err: Error) => void): void;
|
130 | export declare function rmdirSync(path: string): void;
|
131 | export declare function mkdir(path: string, mode?: number, callback?: (err: Error) => void): void;
|
132 | export declare function mkdir(path: string, mode?: string, callback?: (err: Error) => void): void;
|
133 | export declare function mkdirSync(path: string, mode?: number): void;
|
134 | export declare function mkdirSync(path: string, mode?: string): void;
|
135 | export declare function readdir(path: string, callback?: (err: Error, files: string[]) => void): void;
|
136 | export declare function readdirSync(path: string): string[];
|
137 | export declare function close(fd: number, callback?: (err: Error) => void): void;
|
138 | export declare function closeSync(fd: number): void;
|
139 | export declare function open(path: string, flags: string, mode?: string, callback?: (err: Error, fs: number) => void): void;
|
140 | export declare function openSync(path: string, flags: string, mode?: string): number;
|
141 | export declare function utimes(path: string, atime: number, mtime: number, callback?: (err: Error) => void): void;
|
142 | export declare function utimesSync(path: string, atime: number, mtime: number): void;
|
143 | export declare function futimes(fd: number, atime: number, mtime: number, callback?: (err: Error) => void): void;
|
144 | export declare function futimesSync(fd: number, atime: number, mtime: number): void;
|
145 | export declare function fsync(fd: number, callback?: (err: Error) => void): void;
|
146 | export declare function fsyncSync(fd: number): void;
|
147 | export declare function write(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, written: number, buffer: NodeBuffer) => void): void;
|
148 | export declare function writeSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number;
|
149 | export declare function read(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, bytesRead: number, buffer: NodeBuffer) => void): void;
|
150 | export declare function readSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number;
|
151 | export declare function readFile(filename: string, encoding: string, callback: (err: Error, data: string) => void): void;
|
152 | export declare function readFile(filename: string, options: OpenOptions, callback: (err: Error, data: string) => void): void;
|
153 | export declare function readFile(filename: string, callback: (err: Error, data: NodeBuffer) => void): void;
|
154 | export declare function readFileSync(filename: string): NodeBuffer;
|
155 | export declare function readFileSync(filename: string, encoding: string): string;
|
156 | export declare function readFileSync(filename: string, options: OpenOptions): string;
|
157 | export declare function writeFile(filename: string, data: any, encoding?: string, callback?: (err: Error) => void): void;
|
158 | export declare function writeFile(filename: string, data: any, options?: OpenOptions, callback?: (err: Error) => void): void;
|
159 | export declare function writeFileSync(filename: string, data: any, encoding?: string): void;
|
160 | export declare function writeFileSync(filename: string, data: any, option?: OpenOptions): void;
|
161 | export declare function appendFile(filename: string, data: any, encoding?: string, callback?: (err: Error) => void): void;
|
162 | export declare function appendFile(filename: string, data: any, option?: OpenOptions, callback?: (err: Error) => void): void;
|
163 | export declare function appendFileSync(filename: string, data: any, encoding?: string): void;
|
164 | export declare function appendFileSync(filename: string, data: any, option?: OpenOptions): void;
|
165 | export declare function watchFile(filename: string, listener: { curr: Stats; prev: Stats; }): void;
|
166 | export declare function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: { curr: Stats; prev: Stats; }): void;
|
167 | export declare function unwatchFile(filename: string, listener?: Stats): void;
|
168 | export declare function watch(filename: string, options?: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher;
|
169 | export declare function exists(path: string, callback?: (exists: boolean) => void): void;
|
170 | export declare function existsSync(path: string): boolean;
|
171 | export declare function ensureDir(path: string, cb: (err: Error) => void): void;
|
172 | export declare function ensureDirSync(path: string): void;
|
173 | export declare function ensureFile(path: string, cb: (err: Error) => void): void;
|
174 | export declare function ensureFileSync(path: string): void;
|
175 | export declare function ensureLink(path: string, cb: (err: Error) => void): void;
|
176 | export declare function ensureLinkSync(path: string): void;
|
177 | export declare function ensureSymlink(path: string, cb: (err: Error) => void): void;
|
178 | export declare function ensureSymlinkSync(path: string): void;
|
179 | export declare function emptyDir(path: string, callback?: (err: Error) => void): void;
|
180 | export declare function emptyDirSync(path: string): boolean;
|
181 |
|
182 | export interface CopyFilterFunction {
|
183 | (src: string): boolean
|
184 | }
|
185 |
|
186 | export type CopyFilter = CopyFilterFunction | RegExp;
|
187 |
|
188 | export interface CopyOptions {
|
189 | clobber?: boolean
|
190 | preserveTimestamps?: boolean
|
191 | filter?: CopyFilter
|
192 | }
|
193 |
|
194 | export interface OpenOptions {
|
195 | encoding?: string;
|
196 | flag?: string;
|
197 | }
|
198 |
|
199 | export interface MkdirOptions {
|
200 | fs?: any;
|
201 | mode?: number;
|
202 | }
|
203 |
|
204 | export interface ReadStreamOptions {
|
205 | flags?: string;
|
206 | encoding?: string;
|
207 | fd?: number;
|
208 | mode?: number;
|
209 | bufferSize?: number;
|
210 | }
|
211 | export interface WriteStreamOptions {
|
212 | flags?: string;
|
213 | encoding?: string;
|
214 | string?: string;
|
215 | }
|
216 | export declare function createReadStream(path: string, options?: ReadStreamOptions): ReadStream;
|
217 | export declare function createWriteStream(path: string, options?: WriteStreamOptions): WriteStream;
|
218 | export declare function createOutputStream(path: string, options?: WriteStreamOptions): WriteStream;
|