2017-01-26 12:56:40 +00:00
|
|
|
/**
|
2018-02-17 02:24:55 +00:00
|
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
2017-01-26 12:56:40 +00:00
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2017-01-26 12:56:40 +00:00
|
|
|
*
|
|
|
|
* @flow
|
2017-10-31 10:44:59 +00:00
|
|
|
* @format
|
2017-01-26 12:56:40 +00:00
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
2017-10-31 10:44:59 +00:00
|
|
|
declare module 'graceful-fs' {
|
2017-01-26 12:56:40 +00:00
|
|
|
declare class Stats {
|
2017-12-07 01:25:06 +00:00
|
|
|
dev: number;
|
|
|
|
ino: number;
|
|
|
|
mode: number;
|
|
|
|
nlink: number;
|
|
|
|
uid: number;
|
|
|
|
gid: number;
|
|
|
|
rdev: number;
|
|
|
|
size: number;
|
|
|
|
blksize: number;
|
|
|
|
blocks: number;
|
|
|
|
atime: Date;
|
|
|
|
mtime: Date;
|
|
|
|
ctime: Date;
|
2017-01-26 12:56:40 +00:00
|
|
|
|
2017-12-07 01:25:06 +00:00
|
|
|
isFile(): boolean;
|
|
|
|
isDirectory(): boolean;
|
|
|
|
isBlockDevice(): boolean;
|
|
|
|
isCharacterDevice(): boolean;
|
|
|
|
isSymbolicLink(): boolean;
|
|
|
|
isFIFO(): boolean;
|
|
|
|
isSocket(): boolean;
|
2017-01-26 12:56:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
declare class FSWatcher extends events$EventEmitter {
|
2017-12-07 01:25:06 +00:00
|
|
|
close(): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
declare class ReadStream extends stream$Readable {
|
2017-12-07 01:25:06 +00:00
|
|
|
close(): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
declare class WriteStream extends stream$Writable {
|
2017-12-07 01:25:06 +00:00
|
|
|
close(): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
declare function gracefulify(fs: Object): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function rename(
|
|
|
|
oldPath: string,
|
|
|
|
newPath: string,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function renameSync(oldPath: string, newPath: string): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function ftruncate(
|
|
|
|
fd: number,
|
|
|
|
len: number,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function ftruncateSync(fd: number, len: number): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function truncate(
|
|
|
|
path: string,
|
|
|
|
len: number,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function truncateSync(path: string, len: number): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function chown(
|
|
|
|
path: string,
|
|
|
|
uid: number,
|
|
|
|
gid: number,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function chownSync(path: string, uid: number, gid: number): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function fchown(
|
|
|
|
fd: number,
|
|
|
|
uid: number,
|
|
|
|
gid: number,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function fchownSync(fd: number, uid: number, gid: number): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function lchown(
|
|
|
|
path: string,
|
|
|
|
uid: number,
|
|
|
|
gid: number,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function lchownSync(path: string, uid: number, gid: number): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function chmod(
|
|
|
|
path: string,
|
|
|
|
mode: number | string,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function chmodSync(path: string, mode: number | string): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function fchmod(
|
|
|
|
fd: number,
|
|
|
|
mode: number | string,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function fchmodSync(fd: number, mode: number | string): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function lchmod(
|
|
|
|
path: string,
|
|
|
|
mode: number | string,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function lchmodSync(path: string, mode: number | string): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function stat(
|
|
|
|
path: string,
|
|
|
|
callback?: (err: ?Error, stats: Stats) => any,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function statSync(path: string): Stats;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function fstat(
|
|
|
|
fd: number,
|
|
|
|
callback?: (err: ?Error, stats: Stats) => any,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function fstatSync(fd: number): Stats;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function lstat(
|
|
|
|
path: string,
|
|
|
|
callback?: (err: ?Error, stats: Stats) => any,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function lstatSync(path: string): Stats;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function link(
|
|
|
|
srcpath: string,
|
|
|
|
dstpath: string,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function linkSync(srcpath: string, dstpath: string): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function symlink(
|
|
|
|
srcpath: string,
|
|
|
|
dtspath: string,
|
|
|
|
type?: string,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
|
|
|
declare function symlinkSync(
|
|
|
|
srcpath: string,
|
|
|
|
dstpath: string,
|
|
|
|
type: string,
|
|
|
|
): void;
|
|
|
|
declare function readlink(
|
|
|
|
path: string,
|
|
|
|
callback: (err: ?Error, linkString: string) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function readlinkSync(path: string): string;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function realpath(
|
|
|
|
path: string,
|
|
|
|
cache?: Object,
|
|
|
|
callback?: (err: ?Error, resolvedPath: string) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function realpathSync(path: string, cache?: Object): string;
|
|
|
|
declare function unlink(path: string, callback?: (err: ?Error) => void): void;
|
|
|
|
declare function unlinkSync(path: string): void;
|
|
|
|
declare function rmdir(path: string, callback?: (err: ?Error) => void): void;
|
|
|
|
declare function rmdirSync(path: string): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function mkdir(
|
|
|
|
path: string,
|
|
|
|
mode?: number,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function mkdirSync(path: string, mode?: number): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function readdir(
|
|
|
|
path: string,
|
|
|
|
callback?: (err: ?Error, files: Array<string>) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function readdirSync(path: string): Array<string>;
|
|
|
|
declare function close(fd: number, callback?: (err: ?Error) => void): void;
|
|
|
|
declare function closeSync(fd: number): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function open(
|
|
|
|
path: string,
|
|
|
|
flags: string,
|
|
|
|
mode?: number,
|
|
|
|
callback?: (err: ?Error, fd: number) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function openSync(path: string, flags: string, mode?: number): number;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function utimes(
|
|
|
|
path: string,
|
|
|
|
atime: number,
|
|
|
|
mtime: number,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function utimesSync(path: string, atime: number, mtime: number): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function futimes(
|
|
|
|
fd: number,
|
|
|
|
atime: number,
|
|
|
|
mtime: number,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function futimesSync(fd: number, atime: number, mtime: number): void;
|
|
|
|
declare function fsync(fd: number, callback?: (err: ?Error) => void): void;
|
|
|
|
declare function fsyncSync(fd: number): void;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare var write: (
|
|
|
|
fd: number,
|
|
|
|
buffer: Buffer,
|
|
|
|
offset: number,
|
|
|
|
length: number,
|
|
|
|
position?: mixed,
|
|
|
|
callback?: (err: ?Error, write: number, str: string) => void,
|
|
|
|
) =>
|
|
|
|
| void
|
|
|
|
| ((
|
|
|
|
fd: number,
|
|
|
|
data: mixed,
|
|
|
|
position?: mixed,
|
|
|
|
encoding?: string,
|
|
|
|
callback?: (err: ?Error, write: number, str: string) => void,
|
|
|
|
) => void);
|
|
|
|
declare var writeSync: (
|
|
|
|
fd: number,
|
|
|
|
buffer: Buffer,
|
|
|
|
offset: number,
|
|
|
|
length: number,
|
|
|
|
position?: number,
|
|
|
|
) =>
|
|
|
|
| number
|
|
|
|
| ((
|
|
|
|
fd: number,
|
|
|
|
data: mixed,
|
|
|
|
position?: mixed,
|
|
|
|
encoding?: string,
|
|
|
|
) => number);
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function read(
|
|
|
|
fd: number,
|
|
|
|
buffer: Buffer,
|
|
|
|
offset: number,
|
|
|
|
length: number,
|
|
|
|
position: ?number,
|
2017-10-31 10:44:59 +00:00
|
|
|
callback?: (err: ?Error, bytesRead: number, buffer: Buffer) => void,
|
2017-01-26 12:56:40 +00:00
|
|
|
): void;
|
|
|
|
declare function readSync(
|
|
|
|
fd: number,
|
|
|
|
buffer: Buffer,
|
|
|
|
offset: number,
|
|
|
|
length: number,
|
2017-10-31 10:44:59 +00:00
|
|
|
position: number,
|
2017-01-26 12:56:40 +00:00
|
|
|
): number;
|
|
|
|
declare function readFile(
|
|
|
|
filename: string,
|
2017-10-31 10:44:59 +00:00
|
|
|
callback: (err: ?Error, data: Buffer) => void,
|
2017-01-26 12:56:40 +00:00
|
|
|
): void;
|
|
|
|
declare function readFile(
|
|
|
|
filename: string,
|
|
|
|
encoding: string,
|
2017-10-31 10:44:59 +00:00
|
|
|
callback: (err: ?Error, data: string) => void,
|
2017-01-26 12:56:40 +00:00
|
|
|
): void;
|
|
|
|
declare function readFile(
|
|
|
|
filename: string,
|
2017-10-31 10:44:59 +00:00
|
|
|
options: {encoding: string, flag?: string},
|
|
|
|
callback: (err: ?Error, data: string) => void,
|
2017-01-26 12:56:40 +00:00
|
|
|
): void;
|
|
|
|
declare function readFile(
|
|
|
|
filename: string,
|
2017-10-31 10:44:59 +00:00
|
|
|
options: {flag?: string},
|
|
|
|
callback: (err: ?Error, data: Buffer) => void,
|
2017-01-26 12:56:40 +00:00
|
|
|
): void;
|
|
|
|
declare function readFileSync(filename: string, _: void): Buffer;
|
|
|
|
declare function readFileSync(filename: string, encoding: string): string;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function readFileSync(
|
|
|
|
filename: string,
|
|
|
|
options: {encoding: string, flag?: string},
|
|
|
|
): string;
|
|
|
|
declare function readFileSync(
|
|
|
|
filename: string,
|
|
|
|
options: {encoding?: void, flag?: string},
|
|
|
|
): Buffer;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function writeFile(
|
|
|
|
filename: string,
|
|
|
|
data: Buffer | string,
|
|
|
|
options?: Object | string,
|
2017-10-31 10:44:59 +00:00
|
|
|
callback?: (err: ?Error) => void,
|
2017-01-26 12:56:40 +00:00
|
|
|
): void;
|
|
|
|
declare function writeFileSync(
|
|
|
|
filename: string,
|
|
|
|
data: Buffer | string,
|
2017-10-31 10:44:59 +00:00
|
|
|
options?: Object | string,
|
|
|
|
): void;
|
|
|
|
declare function appendFile(
|
|
|
|
filename: string,
|
|
|
|
data: string | Buffer,
|
|
|
|
options?: Object,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
|
|
|
declare function appendFileSync(
|
|
|
|
filename: string,
|
|
|
|
data: string | Buffer,
|
|
|
|
options?: Object,
|
|
|
|
): void;
|
|
|
|
declare function watchFile(
|
|
|
|
filename: string,
|
|
|
|
options?: Object,
|
|
|
|
listener?: (curr: Stats, prev: Stats) => void,
|
|
|
|
): void;
|
|
|
|
declare function unwatchFile(
|
|
|
|
filename: string,
|
|
|
|
listener?: (curr: Stats, prev: Stats) => void,
|
|
|
|
): void;
|
|
|
|
declare function watch(
|
|
|
|
filename: string,
|
|
|
|
options?: Object,
|
|
|
|
listener?: (event: string, filename: string) => void,
|
|
|
|
): FSWatcher;
|
|
|
|
declare function exists(
|
|
|
|
path: string,
|
|
|
|
callback?: (exists: boolean) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function existsSync(path: string): boolean;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function access(
|
|
|
|
path: string,
|
|
|
|
mode?: any,
|
|
|
|
callback?: (err: ?Error) => void,
|
|
|
|
): void;
|
2017-01-26 12:56:40 +00:00
|
|
|
declare function accessSync(path: string, mode?: any): void;
|
|
|
|
declare function createReadStream(path: string, options?: Object): ReadStream;
|
2017-10-31 10:44:59 +00:00
|
|
|
declare function createWriteStream(
|
|
|
|
path: string,
|
|
|
|
options?: Object,
|
|
|
|
): WriteStream;
|
2017-01-26 12:56:40 +00:00
|
|
|
|
|
|
|
declare var F_OK: number;
|
|
|
|
declare var R_OK: number;
|
|
|
|
declare var W_OK: number;
|
|
|
|
declare var X_OK: number;
|
|
|
|
}
|