///
import _fs from 'fs';
declare function copy(src: string, dist: string, opts?: {
/** return true will skip */
skip?: (file: string, stat: _fs.Stats) => Promise | boolean | void;
/** override if exists, default is true */
override?: boolean;
}): Promise;
export declare type WatchDirHandler = (event: string, filename: string) => void;
export declare type WatchDirOptions = {
persistent?: boolean;
/** ms, default 300 */
threshold?: number;
};
declare function watchDir(dir: string, cb: WatchDirHandler): void;
declare function watchDir(dir: string, options: WatchDirOptions, cb: WatchDirHandler): void;
export declare const fs: {
access: typeof _fs.access.__promisify__;
open: typeof _fs.open.__promisify__;
rename: typeof _fs.rename.__promisify__;
truncate: typeof _fs.truncate.__promisify__;
rmdir: typeof _fs.rmdir.__promisify__;
mkdir: typeof _fs.mkdir.__promisify__;
readdir: typeof _fs.readdir.__promisify__;
readlink: typeof _fs.readlink.__promisify__;
symlink: typeof _fs.symlink.__promisify__;
lstat: typeof _fs.lstat.__promisify__;
stat: typeof _fs.stat.__promisify__;
link: typeof _fs.link.__promisify__;
unlink: typeof _fs.unlink.__promisify__;
chmod: typeof _fs.chmod.__promisify__;
chown: typeof _fs.chown.__promisify__;
utimes: typeof _fs.utimes.__promisify__;
realpath: typeof _fs.realpath.__promisify__;
mkdtemp: typeof _fs.mkdtemp.__promisify__;
writeFile: typeof _fs.writeFile.__promisify__;
appendFile: typeof _fs.appendFile.__promisify__;
readFile: typeof _fs.readFile.__promisify__;
existsSync: typeof _fs.existsSync;
createReadString: typeof _fs.createReadStream;
createWriteStream: typeof _fs.createWriteStream;
constants: typeof _fs.constants;
watchDir: typeof watchDir;
copy: typeof copy;
exists(path: _fs.PathLike): Promise;
/** exists via lstat, if a symbolic link's target file doesn't exists, `fs.exists` will return false, but `fs.lexists` will return true. */
lexists(path: _fs.PathLike): Promise;
isFile(path: _fs.PathLike): Promise;
isDirectory(path: _fs.PathLike): Promise;
isSymbolicLink(path: _fs.PathLike): Promise;
copyFile: typeof _fs.copyFile.__promisify__ | ((src: _fs.PathLike, dist: _fs.PathLike) => Promise);
/**
* Make directory with parents, like `mkdir -p`
* @param dir
*/
mkdirp(dir: string): Promise;
/**
* Make directory with parents, like `mkdir -p`
* @param dir
*/
mkdirpSync(dir: string): void;
/**
* Remove file or directory recursively, like `rm -rf`
* @param path The path to remove
* @param opts Options
*/
rmrf(path: string): Promise;
outputFile(path: string, data: any, options?: string | (_fs.BaseEncodingOptions & {
mode?: string | number | undefined;
flag?: string | undefined;
}) | null | undefined): Promise;
outputFileSync(path: string, data: any, options?: string | (_fs.BaseEncodingOptions & {
mode?: string | number | undefined;
flag?: string | undefined;
}) | null | undefined): void;
outputJson(path: string, data: object, options?: ({
space?: number | undefined;
replacer?: ((key: string, value: any) => any) | undefined;
} & string) | ({
space?: number | undefined;
replacer?: ((key: string, value: any) => any) | undefined;
} & _fs.BaseEncodingOptions & {
mode?: string | number | undefined;
flag?: string | undefined;
}) | undefined): Promise;
outputJsonSync(path: string, data: any, options?: ({
space?: number | undefined;
replacer?: ((key: string, value: any) => any) | undefined;
} & string) | ({
space?: number | undefined;
replacer?: ((key: string, value: any) => any) | undefined;
} & _fs.BaseEncodingOptions & {
mode?: string | number | undefined;
flag?: string | undefined;
}) | undefined): void;
readJson(path: string, options?: {
encoding?: null | undefined;
flag?: string | undefined;
} | null | undefined): Promise;
readJsonSync(path: string, options?: {
encoding?: null | undefined;
flag?: string | undefined;
} | null | undefined): T_1;
iter(dir: string, skip: (path: string, stat: _fs.Stats) => Promise | boolean | void): Promise;
renameSync(oldPath: _fs.PathLike, newPath: _fs.PathLike): void;
truncateSync(path: _fs.PathLike, len?: number | null | undefined): void;
ftruncate: typeof _fs.ftruncate;
ftruncateSync(fd: number, len?: number | null | undefined): void;
chownSync(path: _fs.PathLike, uid: number, gid: number): void;
fchown: typeof _fs.fchown;
fchownSync(fd: number, uid: number, gid: number): void;
lchown: typeof _fs.lchown;
lchownSync(path: _fs.PathLike, uid: number, gid: number): void;
chmodSync(path: _fs.PathLike, mode: string | number): void;
fchmod: typeof _fs.fchmod;
fchmodSync(fd: number, mode: string | number): void;
lchmod: typeof _fs.lchmod;
lchmodSync(path: _fs.PathLike, mode: string | number): void;
statSync(path: _fs.PathLike, options: _fs.BigIntOptions): _fs.BigIntStats;
statSync(path: _fs.PathLike, options: _fs.StatOptions): _fs.Stats | _fs.BigIntStats;
statSync(path: _fs.PathLike): _fs.Stats;
fstat: typeof _fs.fstat;
fstatSync(fd: number): _fs.Stats;
lstatSync(path: _fs.PathLike): _fs.Stats;
linkSync(existingPath: _fs.PathLike, newPath: _fs.PathLike): void;
symlinkSync(target: _fs.PathLike, path: _fs.PathLike, type?: "dir" | "file" | "junction" | null | undefined): void;
readlinkSync(path: _fs.PathLike, options?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | _fs.BaseEncodingOptions | null | undefined): string;
readlinkSync(path: _fs.PathLike, options: _fs.BufferEncodingOption): Buffer;
readlinkSync(path: _fs.PathLike, options?: string | _fs.BaseEncodingOptions | null | undefined): string | Buffer;
realpathSync: typeof _fs.realpathSync;
unlinkSync(path: _fs.PathLike): void;
rmdirSync(path: _fs.PathLike, options?: _fs.RmDirOptions | undefined): void;
mkdirSync(path: _fs.PathLike, options: _fs.MakeDirectoryOptions & {
recursive: true;
}): string;
mkdirSync(path: _fs.PathLike, options?: string | number | (_fs.MakeDirectoryOptions & {
recursive?: false | undefined;
}) | null | undefined): void;
mkdirSync(path: _fs.PathLike, options?: string | number | _fs.MakeDirectoryOptions | null | undefined): string | undefined;
mkdtempSync(prefix: string, options?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | _fs.BaseEncodingOptions | null | undefined): string;
mkdtempSync(prefix: string, options: _fs.BufferEncodingOption): Buffer;
mkdtempSync(prefix: string, options?: string | _fs.BaseEncodingOptions | null | undefined): string | Buffer;
readdirSync(path: _fs.PathLike, options?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | {
encoding: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | null;
withFileTypes?: false | undefined;
} | null | undefined): string[];
readdirSync(path: _fs.PathLike, options: "buffer" | {
encoding: "buffer";
withFileTypes?: false | undefined;
}): Buffer[];
readdirSync(path: _fs.PathLike, options?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | (_fs.BaseEncodingOptions & {
withFileTypes?: false | undefined;
}) | null | undefined): string[] | Buffer[];
readdirSync(path: _fs.PathLike, options: _fs.BaseEncodingOptions & {
withFileTypes: true;
}): _fs.Dirent[];
close: typeof _fs.close;
closeSync(fd: number): void;
openSync(path: _fs.PathLike, flags: string | number, mode?: string | number | null | undefined): number;
utimesSync(path: _fs.PathLike, atime: string | number | Date, mtime: string | number | Date): void;
futimes: typeof _fs.futimes;
futimesSync(fd: number, atime: string | number | Date, mtime: string | number | Date): void;
fsync: typeof _fs.fsync;
fsyncSync(fd: number): void;
write: typeof _fs.write;
writeSync(fd: number, buffer: NodeJS.ArrayBufferView, offset?: number | null | undefined, length?: number | null | undefined, position?: number | null | undefined): number;
writeSync(fd: number, string: string, position?: number | null | undefined, encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | null | undefined): number;
read: typeof _fs.read;
readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: number | null): number;
readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: _fs.ReadSyncOptions | undefined): number;
readFileSync(path: string | number | Buffer | import("url").URL, options?: {
encoding?: null | undefined;
flag?: string | undefined;
} | null | undefined): Buffer;
readFileSync(path: string | number | Buffer | import("url").URL, options: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | {
encoding: BufferEncoding;
flag?: string | undefined;
}): string;
readFileSync(path: string | number | Buffer | import("url").URL, options?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | (_fs.BaseEncodingOptions & {
flag?: string | undefined;
}) | null | undefined): string | Buffer;
writeFileSync(path: string | number | Buffer | import("url").URL, data: string | DataView | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, options?: string | (_fs.BaseEncodingOptions & {
mode?: string | number | undefined;
flag?: string | undefined;
}) | null | undefined): void;
appendFileSync(file: string | number | Buffer | import("url").URL, data: string | Uint8Array, options?: string | (_fs.BaseEncodingOptions & {
mode?: string | number | undefined;
flag?: string | undefined;
}) | null | undefined): void;
watchFile(filename: _fs.PathLike, options: {
persistent?: boolean | undefined;
interval?: number | undefined;
} | undefined, listener: (curr: _fs.Stats, prev: _fs.Stats) => void): void;
watchFile(filename: _fs.PathLike, listener: (curr: _fs.Stats, prev: _fs.Stats) => void): void;
unwatchFile(filename: _fs.PathLike, listener?: ((curr: _fs.Stats, prev: _fs.Stats) => void) | undefined): void;
watch(filename: _fs.PathLike, options: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | {
encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | null | undefined;
persistent?: boolean | undefined;
recursive?: boolean | undefined;
} | null | undefined, listener?: ((event: string, filename: string) => void) | undefined): _fs.FSWatcher;
watch(filename: _fs.PathLike, options: "buffer" | {
encoding: "buffer";
persistent?: boolean | undefined;
recursive?: boolean | undefined;
}, listener?: ((event: string, filename: Buffer) => void) | undefined): _fs.FSWatcher;
watch(filename: _fs.PathLike, options: string | {
encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | null | undefined;
persistent?: boolean | undefined;
recursive?: boolean | undefined;
} | null, listener?: ((event: string, filename: string | Buffer) => void) | undefined): _fs.FSWatcher;
watch(filename: _fs.PathLike, listener?: ((event: string, filename: string) => any) | undefined): _fs.FSWatcher;
accessSync(path: _fs.PathLike, mode?: number | undefined): void;
createReadStream(path: _fs.PathLike, options?: string | {
flags?: string | undefined;
encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined;
fd?: number | undefined;
mode?: number | undefined;
autoClose?: boolean | undefined;
emitClose?: boolean | undefined;
start?: number | undefined;
end?: number | undefined;
highWaterMark?: number | undefined;
} | undefined): _fs.ReadStream;
fdatasync: typeof _fs.fdatasync;
fdatasyncSync(fd: number): void;
copyFileSync(src: _fs.PathLike, dest: _fs.PathLike, flags?: number | undefined): void;
writev: typeof _fs.writev;
writevSync(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number | undefined): number;
readv: typeof _fs.readv;
readvSync(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number | undefined): number;
opendirSync(path: string, options?: _fs.OpenDirOptions | undefined): _fs.Dir;
opendir: typeof _fs.opendir;
promises: typeof _fs.promises;
Stats: typeof _fs.Stats;
Dirent: typeof _fs.Dirent;
Dir: typeof _fs.Dir;
ReadStream: typeof _fs.ReadStream;
WriteStream: typeof _fs.WriteStream;
BigIntStats: typeof _fs.BigIntStats;
};
export {};