import fs, { Stats } from 'fs'; /** * FileSystem interface provides a strongly-typed abstraction * over common Node.js filesystem operations. */ export interface CBFileSystem { /** Checks whether a given path exists on the filesystem. */ existsSync: (path: string) => boolean; /** Reads the contents of a directory and returns an array of entries. */ readdirSync: (path: string, options?: any) => any[]; /** Creates a new directory, optionally allowing recursive creation. */ mkdirSync: (path: string, options?: { recursive: boolean; }) => void; /** Deletes a file at the given path. */ unlinkSync: (path: string) => void; /** Removes a directory at the given path. */ rmdirSync: (path: string) => void; /** Returns stats for a given path, including directory check and size. */ statSync: (path: string) => { isDirectory: () => boolean; size: number; }; /** Creates a writable stream to a file at the given path. */ createWriteStream: (path: string) => NodeJS.WritableStream; /** Reads a file's contents as a string with specified encoding. */ readFileSync: (path: string, encoding: string) => string; /** Writes string data to a file at the given path. */ writeFileSync: (path: string, data: string) => void; /** Copies a file from source to destination. */ copyFileSync: (src: string, dest: string) => void; /** Returns stats for a given path, including symbolic link check. */ lstatSync: (path: string) => Stats; /** Renames a file or directory. */ renameSync: (oldPath: string, newPath: string) => void; /** Copies a file or directory from source to destination. */ cpSync: (src: string, dest: string, options?: { recursive: boolean; }) => void; } /** * FileSystemService provides a class-based implementation of the FileSystem interface. * Use this for dependency injection for all the filesystem operations, and for testing we can use custom implemenatation if needed. */ export declare class FileSystemService implements CBFileSystem { existsSync(path: string): boolean; readdirSync(path: string, options?: any): any[]; mkdirSync(path: string, options?: { recursive: boolean; }): void; unlinkSync(path: string): void; rmdirSync(path: string): void; statSync(path: string): { isDirectory: () => boolean; size: number; }; createWriteStream(path: string): fs.WriteStream; readFileSync(path: string, encoding: string): string; writeFileSync(path: string, data: string): void; copyFileSync(src: string, dest: string): void; lstatSync(path: string): Stats; renameSync(oldPath: string, newPath: string): void; cpSync(src: string, dest: string, options?: { recursive: boolean; }): void; }