import type { RmOptions } from 'node:fs'; import fs from 'node:fs'; import fsp from 'node:fs/promises'; /** * fs2 conveniently groups filesystem functions together. * Supposed to be almost a drop-in replacement for these things together: * * 1. node:fs * 2. node:fs/promises * 3. fs-extra */ declare class FS2 { /** * Convenience wrapper that defaults to utf-8 string output. */ readText(filePath: string): string; /** * Convenience wrapper that defaults to utf-8 string output. */ readTextAsync(filePath: string): Promise; readBuffer(filePath: string): Buffer; readBufferAsync(filePath: string): Promise; readJson(filePath: string): T; readJsonAsync(filePath: string): Promise; writeFile(filePath: string, data: string | Buffer): void; writeFileAsync(filePath: string, data: string | Buffer): Promise; writeJson(filePath: string, data: any, opt?: JsonOptions): void; writeJsonAsync(filePath: string, data: any, opt?: JsonOptions): Promise; appendFile(filePath: string, data: string | Buffer): void; appendFileAsync(filePath: string, data: string | Buffer): Promise; outputJson(filePath: string, data: any, opt?: JsonOptions): void; outputJsonAsync(filePath: string, data: any, opt?: JsonOptions): Promise; outputFile(filePath: string, data: string | Buffer): void; outputFileAsync(filePath: string, data: string | Buffer): Promise; pathExists(filePath: string): boolean; pathExistsAsync(filePath: string): Promise; requireFileToExist(filePath: string): void; ensureDir(dirPath: string): void; ensureDirAsync(dirPath: string): Promise; ensureFile(filePath: string): void; ensureFileAsync(filePath: string): Promise; removePath(fileOrDirPath: string, opt?: RmOptions): void; removePathAsync(fileOrDirPath: string, opt?: RmOptions): Promise; emptyDir(dirPath: string): void; emptyDirAsync(dirPath: string): Promise; /** * Cautious, underlying Node function is currently Experimental. */ copyPath(src: string, dest: string, opt?: fs.CopySyncOptions): void; /** * Cautious, underlying Node function is currently Experimental. */ copyPathAsync(src: string, dest: string, opt?: fs.CopyOptions): Promise; renamePath(src: string, dest: string): void; renamePathAsync(src: string, dest: string): Promise; movePath(src: string, dest: string, opt?: fs.CopySyncOptions): void; movePathAsync(src: string, dest: string, opt?: fs.CopyOptions): Promise; /** * Returns true if the path is a directory. * Otherwise returns false. * Doesn't throw, returns false instead. */ isDirectory(filePath: string): boolean; fs: typeof fs; fsp: typeof fsp; lstat: fs.StatSyncFn; lstatAsync: typeof fsp.lstat; stat: fs.StatSyncFn; statAsync: typeof fsp.stat; mkdir: typeof fs.mkdirSync; mkdirAsync: typeof fsp.mkdir; readdir: typeof fs.readdirSync; readdirAsync: typeof fsp.readdir; createWriteStream: typeof fs.createWriteStream; createReadStream: typeof fs.createReadStream; } export declare const fs2: FS2; export interface JsonOptions { spaces?: number; } export {};