/** * Native Node.js fs API Helpers * * Drop-in replacements for fs-extra methods using only Node.js stdlib. * All methods use native Node.js 20+ APIs with no external dependencies. * * Migration from fs-extra: * - import fs from 'fs-extra' → import * as fs from './utils/fs-native.js' * - All fs-extra methods work as drop-in replacements * * Benefits: * - Zero bundle overhead (no npm packages) * - Works in marketplace (no node_modules needed) * - Faster startup (native APIs) * - Better debugging (native stack traces) */ import { promises as fsPromises, existsSync, mkdirSync, readFileSync, writeFileSync, statSync, readdirSync, rmSync, unlinkSync } from 'fs'; /** * Ensures that a directory exists. If the directory does not exist, it is created. * @param dirPath - The directory path to ensure */ export declare function ensureDir(dirPath: string): Promise; /** * Synchronous version of ensureDir */ export declare function ensureDirSync(dirPath: string): void; /** * Alias for ensureDirSync (fs-extra compatibility) */ export declare function mkdirpSync(dirPath: string): void; /** * Check if a path exists * @param filePath - The path to check */ export declare function pathExists(filePath: string): Promise; /** * Synchronous version of pathExists */ export { existsSync }; /** * Read a JSON file and parse it * @param filePath - The JSON file path */ export declare function readJson(filePath: string): Promise; /** * Synchronous version of readJson */ export declare function readJsonSync(filePath: string): any; /** * Write a JSON file with formatting * @param filePath - The JSON file path * @param data - The data to write * @param options - Options (spaces for indentation) */ export declare function writeJson(filePath: string, data: any, options?: { spaces?: number; }): Promise; /** * Synchronous version of writeJson */ export declare function writeJsonSync(filePath: string, data: any, options?: { spaces?: number; }): void; /** * Remove a file or directory (recursively) * @param targetPath - The path to remove */ export declare function remove(targetPath: string): Promise; /** * Synchronous version of remove */ export declare function removeSync(targetPath: string): void; /** * Copy a file or directory * @param src - Source path * @param dest - Destination path * @param options - Copy options */ export declare function copy(src: string, dest: string, options?: { overwrite?: boolean; filter?: (src: string) => boolean; }): Promise; /** * Synchronous version of copy */ export declare function copySync(src: string, dest: string, options?: { overwrite?: boolean; filter?: (src: string) => boolean; }): void; /** * Ensure a file exists (create if it doesn't) * @param filePath - The file path */ export declare function ensureFile(filePath: string): Promise; /** * Synchronous version of ensureFile */ export declare function ensureFileSync(filePath: string): void; export declare const readFile: typeof fsPromises.readFile, writeFile: typeof fsPromises.writeFile, appendFile: typeof fsPromises.appendFile, stat: typeof fsPromises.stat, readdir: typeof fsPromises.readdir, access: typeof fsPromises.access, unlink: typeof fsPromises.unlink, rmdir: typeof fsPromises.rmdir, rename: typeof fsPromises.rename, chmod: typeof fsPromises.chmod; export { readFileSync, writeFileSync, statSync, readdirSync, unlinkSync, mkdirSync, rmSync, }; declare const _default: { ensureDir: typeof ensureDir; pathExists: typeof pathExists; readJson: typeof readJson; writeJson: typeof writeJson; remove: typeof remove; copy: typeof copy; ensureFile: typeof ensureFile; readFile: typeof fsPromises.readFile; writeFile: typeof fsPromises.writeFile; appendFile: typeof fsPromises.appendFile; stat: typeof fsPromises.stat; readdir: typeof fsPromises.readdir; access: typeof fsPromises.access; unlink: typeof fsPromises.unlink; ensureDirSync: typeof ensureDirSync; mkdirpSync: typeof mkdirpSync; existsSync: typeof existsSync; readJsonSync: typeof readJsonSync; writeJsonSync: typeof writeJsonSync; removeSync: typeof removeSync; copySync: typeof copySync; ensureFileSync: typeof ensureFileSync; readFileSync: typeof readFileSync; writeFileSync: typeof writeFileSync; statSync: typeof statSync; readdirSync: typeof readdirSync; unlinkSync: typeof unlinkSync; mkdirSync: typeof mkdirSync; rmSync: typeof rmSync; }; export default _default; //# sourceMappingURL=fs-native.d.ts.map