@elsikora/setup-wizard
Version:
Setup Wizard - CLI scaffolding utility
63 lines (62 loc) • 2.76 kB
TypeScript
import type { IFileSystemService } from "../../application/interface/file-system-service.interface";
/**
* Implementation of the file system service using Node.js fs/promises API.
* Provides methods for managing files and directories.
*/
export declare class NodeFileSystemService implements IFileSystemService {
/**
* Creates a directory at the specified path.
* @param directoryPath - The path to the directory to create
* @param options - Optional configuration for directory creation
* @param options.isRecursive - Whether to create parent directories if they don't exist
* @returns Promise that resolves when the directory is created
*/
createDirectory(directoryPath: string, options?: {
isRecursive: boolean;
}): Promise<void>;
/**
* Deletes a file at the specified path.
* @param filePath - The path to the file to delete
* @returns Promise that resolves when the file is deleted
*/
deleteFile(filePath: string): Promise<void>;
/**
* Gets the directory name from a file path.
* @param filePath
* @returns The directory name
*/
getDirectoryNameFromFilePath(filePath: string): string;
/**
* Gets the extension from a file path.
* @param filePath
* @returns The file extension
*/
getExtensionFromFilePath(filePath: string): string;
/**
* Checks if any of the provided paths exist and returns the first existing path.
* @param paths - Array of paths to check
* @returns Promise that resolves to the first existing path or undefined if none exist
*/
isOneOfPathsExists(paths: Array<string>): Promise<string | undefined>;
/**
* Checks if a file or directory exists at the specified path.
* @param filePath - The path to check
* @returns Promise that resolves to true if the path exists, false otherwise
*/
isPathExists(filePath: string): Promise<boolean>;
/**
* Reads the contents of a file.
* @param filePath - The path to the file to read
* @param encoding - The encoding to use when reading the file, defaults to "utf8"
* @returns Promise that resolves to the file contents as a string
*/
readFile(filePath: string, encoding?: BufferEncoding): Promise<string>;
/**
* Writes content to a file, creating the file and parent directories if they don't exist.
* @param filePath - The path to the file to write
* @param content - The content to write to the file
* @param encoding - The encoding to use when writing the file, defaults to "utf8"
* @returns Promise that resolves when the file is written
*/
writeFile(filePath: string, content: string, encoding?: BufferEncoding): Promise<void>;
}