fs-extender
Version:
Extras suite for node fs module
174 lines (173 loc) • 14.2 kB
TypeScript
/// <reference path="patch/patchStream.d.ts" />
/// <reference types="node" />
/// <reference types="node/fs" />
export * from "./patch";
export { list, listSync, ListOptions, ListResultType } from "./list";
export { find, findSync, FindFilterType, FindOptions, FindResultType, FindFilterFunction, FindFilterFunctionAsync, FindOptionsAsync, FindFilterTypeAsync, } from "./find";
export { mkdirp, mkdirpSync, MkdirpOptions } from "./mkdirp";
export { rm, rmSync, emptyDir, emptyDirSync, RmOptions, EmptyDirOptions, RmStreamOutType } from "./rm";
export { copy, copySync, CopyOptions, CopyOptionsErrorStream, CopyStats, CopyStreamOutType } from "./copy";
export { move, moveSync, MoveOptions, MoveStreamOutType } from "./move";
export { dirByte, dirByteSync, dirHash, dirHashSync, filesByte, filesByteSync, filesHash, filesHashSync, CompareOptionsByte, CompareOptionsHash, } from "./compare";
export { ensureDir, ensureDirSync, ensureFile, ensureFileSync, ensureLink, ensureLinkSync, ensureSymlink, ensureSymlinkSync, EnsureOptionsDir, EnsureOptionsFile, EnsureOptionsSymlink, EnsureOptionsSymlinkType, EnsureSymlinkPathsType, EnsureOptionsFileStreamOptions, } from "./ensure";
export { ensureJsonFile, ensureJsonFileSync, readJsonFile, readJsonFileSync, writeJsonFile, writeJsonFileSync, readJsonLines, ReadJsonOptions, ReplacerType, ReviverType, WriteJsonOptions, ReadJsonLineOptions, ReadJsonLinesFunction, } from "./json";
export { size, sizeSync, SizeOptions, SizeStats } from "./size";
export { walk, walkSync, WalkAsyncFunction, WalkFunction, WalkOptions } from "./walk";
export declare const promises: {
walk(path: import("fs").PathLike, options: import("./walk").WalkOptions, walkFunction: import("./walk").WalkAsyncFunction): Promise<void>;
walk(path: import("fs").PathLike, walkFunction: import("./walk").WalkAsyncFunction): Promise<void>;
size(path: import("fs").PathLike, options?: import("./size").SizeOptions | undefined): Promise<import("./size").SizeStats>;
writeJsonFile(path: import("fs").PathLike, obj: unknown, options?: import("./json").WriteJsonOptions | undefined): Promise<import("fs").PathLike>;
ensureJsonFile(path: import("fs").PathLike, obj: unknown, options?: import("./json").WriteJsonOptions | undefined): Promise<import("fs").PathLike>;
readJsonFile<T>(path: import("fs").PathLike, options?: import("./json").ReadJsonOptions | undefined): Promise<T>;
readJsonLines(path: import("fs").PathLike, options: import("./json").ReadJsonLineOptions, fn: import("./json").ReadJsonLinesFunction): Promise<void>;
readJsonLines(path: import("fs").PathLike, fn: import("./json").ReadJsonLinesFunction): Promise<void>;
ensureFile: typeof import("./ensure/async/file").promises.ensureFile;
ensureDir: typeof import("./ensure/async/dir").promises.ensureDir;
ensureLink: typeof import("./ensure/async/link").promises.ensureLink;
ensureSymlink: typeof import("./ensure/async/symlink").promises.ensureSymlink;
filesHash: typeof import("./compare/file").promises.filesHash;
filesByte: typeof import("./compare/file").promises.filesByte;
dirHash: typeof import("./compare/dir").promises.dirHash;
dirByte: typeof import("./compare/dir").promises.dirByte;
move(src: import("fs").PathLike, dst: import("fs").PathLike, options?: import("./move").MoveOptions | undefined): Promise<void>;
copy(src: Buffer, dst: import("fs").PathLike, options?: import("./find").FindFilterTypeAsync<Buffer> | import("./copy").CopyOptions<Buffer> | undefined): Promise<import("./copy").CopyStats>;
copy(src: import("fs").PathLike, dst: Buffer, options?: import("./find").FindFilterTypeAsync<Buffer> | import("./copy").CopyOptions<Buffer> | undefined): Promise<import("./copy").CopyStats>;
copy(src: string | URL, dst: string | URL, options?: import("./find").FindFilterTypeAsync<string> | import("./copy").CopyOptions<string> | undefined): Promise<import("./copy").CopyStats>;
copy(src: import("fs").PathLike, dst: import("fs").PathLike, options?: import("./find").FindFilterTypeAsync<string | Buffer> | import("./copy").CopyOptions<string | Buffer> | undefined): Promise<import("./copy").CopyStats>;
rm(path: import("fs").PathLike, options?: import("./rm").RmOptions | undefined): Promise<void>;
emptyDir(path: import("fs").PathLike, options?: import("./rm").EmptyDirOptions | undefined): Promise<void>;
mkdirp(path: import("fs").PathLike | import("fs").PathLike[], options?: import("fs").Mode | import("./mkdirp").MkdirpOptions | null | undefined): Promise<import("fs").PathLike | import("fs").PathLike[]>;
find(path: import("fs").PathLike, options: (import("./list").ListOptions & {
filter?: import("./find").FindFilterType<Buffer> | undefined;
} & {
encoding: "buffer";
}) | import("./find").FindFilterType<Buffer>): Promise<import("./find").FindResultType<Buffer>[]>;
find(path: string | import("url").URL, options?: import("./find").FindOptionsAsync<string> | import("./find").FindFilterTypeAsync<string> | undefined): Promise<import("./find").FindResultType<string>[]>;
find(path: Buffer, options?: import("./find").FindOptionsAsync<Buffer> | import("./find").FindFilterTypeAsync<Buffer> | undefined): Promise<import("./find").FindResultType<Buffer>[]>;
find(path: import("fs").PathLike, options?: import("./find").FindOptionsAsync<string | Buffer> | import("./find").FindFilterTypeAsync<string | Buffer> | undefined): Promise<import("./find").FindResultType<string | Buffer>[]>;
list(path: import("fs").PathLike, options: import("./list").ListOptions & {
encoding: "buffer";
}): Promise<import("./list").ListResultType<Buffer>[]>;
list(path: string | import("url").URL, options?: import("./list").ListOptions | undefined): Promise<import("./list").ListResultType<string>[]>;
list(path: Buffer, options?: import("./list").ListOptions | undefined): Promise<import("./list").ListResultType<Buffer>[]>;
list(path: import("fs").PathLike, options?: import("./list").ListOptions | undefined): Promise<import("./list").ListResultType<string | Buffer>[]>;
access(path: import("fs").PathLike, mode?: number | undefined): Promise<void>;
appendFile(file: import("fs").PathOrFileDescriptor, data: string | Uint8Array, options?: import("fs").WriteFileOptions | undefined): Promise<void>;
copyFile(src: import("fs").PathLike, dst: import("fs").PathLike, mode?: number | undefined): Promise<void>;
chown(path: import("fs").PathLike, uid: number, gid: number): Promise<void>;
fchown(fd: number, uid: number, gid: number): Promise<void>;
lchown(path: import("fs").PathLike, uid: number, gid: number): Promise<void>;
chmod(path: import("fs").PathLike, mode: import("fs").Mode): Promise<void>;
fchmod(fd: number, mode: import("fs").Mode): Promise<void>;
lchomd(path: import("fs").PathLike, mode: import("fs").Mode): Promise<void>;
cp(source: import("fs").PathLike, destination: import("fs").PathLike, opts?: import("./copy").CopyOptions<string | Buffer> | undefined): Promise<void>;
exists(path: import("fs").PathLike): Promise<boolean>;
existAccess(path: import("fs").PathLike, mode?: number | undefined): Promise<boolean>;
isEmpty(path: import("fs").PathLike, options?: {
dereference?: boolean | undefined;
}): Promise<boolean>;
link(existingPath: import("fs").PathLike, newPath: import("fs").PathLike): Promise<void>;
lutimes(path: import("fs").PathLike, atime: import("fs").TimeLike, mtime: import("fs").TimeLike): Promise<void>;
mkdir(path: import("fs").PathLike, options: import("fs").MakeDirectoryOptions & {
recursive: true;
}): Promise<string | undefined>;
mkdir(path: import("fs").PathLike, options?: import("fs").Mode | (import("fs").MakeDirectoryOptions & {
recursive?: false | undefined;
}) | null | undefined): Promise<void>;
mkdir(path: import("fs").PathLike, options?: import("fs").Mode | import("fs").MakeDirectoryOptions | null | undefined): Promise<string | undefined>;
mkdtemp(prefix: string, options?: BufferEncoding | import("fs").ObjectEncodingOptions | null | undefined): Promise<string>;
mkdtemp(prefix: string, options: import("fs").BufferEncodingOption): Promise<Buffer>;
mkdtemp(prefix: string, options?: BufferEncoding | import("fs").ObjectEncodingOptions | null | undefined): Promise<string | Buffer>;
open(path: import("fs").PathLike, flags: string | number, mode?: import("fs").Mode | undefined): Promise<import("fs/promises").FileHandle>;
read<TBuffer extends NodeJS.ArrayBufferView>(fd: number, buffer: TBuffer, offset: number, length: number, position: number | null): Promise<{
bytesRead: number;
buffer: TBuffer;
}>;
readdir(path: import("fs").PathLike, options?: BufferEncoding | {
encoding: BufferEncoding | null;
withFileTypes?: false | undefined;
} | null | undefined): Promise<string[]>;
readdir(path: import("fs").PathLike, options: "buffer" | {
encoding: "buffer";
withFileTypes?: false | undefined;
}): Promise<Buffer[]>;
readdir(path: import("fs").PathLike, options?: BufferEncoding | (import("fs").ObjectEncodingOptions & {
withFileTypes?: false | undefined;
}) | null | undefined): Promise<Buffer[] | string[]>;
readdir(path: import("fs").PathLike, options: import("fs").ObjectEncodingOptions & {
withFileTypes: true;
}): Promise<import("fs").Dirent[]>;
readDir(path: import("fs").PathLike, options?: BufferEncoding | {
encoding: BufferEncoding | null;
withFileTypes?: false | undefined;
} | null | undefined): Promise<string[]>;
readDir(path: import("fs").PathLike, options: "buffer" | {
encoding: "buffer";
withFileTypes?: false | undefined;
}): Promise<Buffer[]>;
readDir(path: import("fs").PathLike, options?: BufferEncoding | (import("fs").ObjectEncodingOptions & {
withFileTypes?: false | undefined;
}) | null | undefined): Promise<Buffer[] | string[]>;
readDir(path: import("fs").PathLike, options: import("fs").ObjectEncodingOptions & {
withFileTypes: true;
}): Promise<import("fs").Dirent[]>;
readFile(path: import("fs").PathOrFileDescriptor, options?: {
encoding?: null | undefined;
flag?: string | undefined;
} | null | undefined): Promise<Buffer>;
readFile(path: import("fs").PathOrFileDescriptor, options: BufferEncoding | {
encoding: BufferEncoding;
flag?: string | undefined;
}): Promise<string>;
readFile(path: import("fs").PathOrFileDescriptor, options?: BufferEncoding | (import("fs").ObjectEncodingOptions & {
flag?: string | undefined;
}) | null | undefined): Promise<string | Buffer>;
readlink(path: import("fs").PathLike, options?: BufferEncoding | import("fs").ObjectEncodingOptions | null | undefined): Promise<string>;
readlink(path: import("fs").PathLike, options: import("fs").BufferEncodingOption): Promise<Buffer>;
readlink(path: import("fs").PathLike, options?: string | import("fs").ObjectEncodingOptions | null | undefined): Promise<string | Buffer>;
realpath(path: import("fs").PathLike, options?: BufferEncoding | import("fs").ObjectEncodingOptions | null | undefined): Promise<string>;
realpath(path: import("fs").PathLike, options: import("fs").BufferEncodingOption): Promise<Buffer>;
realpath(path: import("fs").PathLike, options?: BufferEncoding | import("fs").ObjectEncodingOptions | null | undefined): Promise<string | Buffer>;
rename(oldPath: import("fs").PathLike, newPath: import("fs").PathLike): Promise<void>;
rmdir(path: import("fs").PathLike, options?: import("fs").RmDirOptions | undefined): Promise<void>;
stat(path: import("fs").PathLike, options?: (import("fs").StatOptions & {
bigint?: false | undefined;
}) | undefined): Promise<import("fs").Stats>;
stat(path: import("fs").PathLike, options: import("fs").StatOptions & {
bigint: true;
}): Promise<import("fs").BigIntStats>;
stat(path: import("fs").PathLike, options?: import("fs").StatOptions | undefined): Promise<import("fs").Stats | import("fs").BigIntStats>;
fstat(fd: number, options?: (import("fs").StatOptions & {
bigint?: false | undefined;
}) | undefined): Promise<import("fs").Stats>;
fstat(fd: number, options: import("fs").StatOptions & {
bigint: true;
}): Promise<import("fs").BigIntStats>;
fstat(fd: number, options?: import("fs").StatOptions | undefined): Promise<import("fs").Stats | import("fs").BigIntStats>;
lstat(path: import("fs").PathLike, options?: (import("fs").StatOptions & {
bigint?: false | undefined;
}) | undefined): Promise<import("fs").Stats>;
lstat(path: import("fs").PathLike, options: import("fs").StatOptions & {
bigint: true;
}): Promise<import("fs").BigIntStats>;
lstat(path: import("fs").PathLike, options?: import("fs").StatOptions | undefined): Promise<import("fs").Stats | import("fs").BigIntStats>;
statIsDirectory(path: import("fs").PathLike): Promise<{
isType: boolean;
stats: import("fs").Stats | import("fs").BigIntStats;
}>;
statIsFile(path: import("fs").PathLike): Promise<{
isType: boolean;
stats: import("fs").Stats | import("fs").BigIntStats;
}>;
statIsSymbolicLink(path: import("fs").PathLike): Promise<{
isType: boolean;
stats: import("fs").Stats | import("fs").BigIntStats;
}>;
symlink(target: import("fs").PathLike, path: import("fs").PathLike, type?: "dir" | "file" | "junction" | null | undefined): Promise<void>;
truncate(path: import("fs").PathLike, len?: number | undefined): Promise<void>;
unlink(path: import("fs").PathLike): Promise<void>;
utimes(path: import("fs").PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
writeFile(path: import("fs").PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options?: import("fs").WriteFileOptions | undefined): Promise<void>;
opendir(path: import("fs").PathLike, options?: import("fs").OpenDirOptions | undefined): Promise<import("fs").Dir>;
};