UNPKG

@agility/cli

Version:

Agility CLI for working with your content. (Public Beta)

74 lines (73 loc) 3.63 kB
import * as fs from 'fs'; export declare class fileOperations { private _rootPath; private _guid; private _locale; private _legacyFolders; private _resolvedRootPath; private _basePath; private _instanceLogDir; private _currentLogFilePath; private _isGuidLevel; private _mappingsPath; constructor(guid: string, locale?: string); get instancePath(): string; get mappingsPath(): string; get isLegacyMode(): boolean; get resolvedRootPath(): string; get guid(): string; get locale(): string; /** * Strip ANSI color codes from text for clean log files * Matches ANSI escape sequences like [33m, [3m, [23m, [39m, etc. * Also cleans up JSON formatting for better readability */ private stripAnsiCodes; exportFiles(folder: string, fileIdentifier: any, extractedObject: any, baseFolder?: string): void; appendFiles(folder: string, fileIdentifier: any, extractedObject: any): void; createLogFile(folder: string, fileIdentifier: any, baseFolder?: string): void; appendLogFile(data: string): void; createFolder(folder: string): boolean; createBaseFolder(folder?: string): void; checkBaseFolderExists(folder: string): boolean; getFolderContents(folder: string): string[]; downloadFile(url: string, targetFile: string): Promise<unknown>; createFile(filename: string, content: string): void; saveFile(filename: string, content: string): void; saveFileToPath(filename: string, content: string, filePath: string): void; readFile(fileName: string): string; createReadStream(fileName: string): fs.ReadStream; checkFileExists(filePath: string): boolean; deleteFile(fileName: string): void; getMappingFilePath(sourceGuid: string, targetGuid: string, locale?: string | null): string; getMappingFile(type: string, sourceGuid: string, targetGuid: string, locale?: string | null): any[]; saveMappingFile(mappingData: any[], type?: string, sourceGuid?: string, targetGuid?: string, locale?: string | null): void; /** * Get reverse mapping file path for fallback lookups * For B→A sync: when A→B mapping file exists, use it by flipping the source/target GUIDs */ getReverseMappingFilePath(sourceGuid: string, targetGuid: string, locale?: string): string; loadMappingFile(sourceGuid: string, targetGuid: string, locale?: string): any | null; clearMappingFile(sourceGuid: string, targetGuid: string, locale?: string): void; getDataFolderPath(folderName?: string): string; getFolderPath(folderName?: string): string; getFilePath(folderName?: string, fileName?: string): string; getDataFilePath(folderName?: string, fileName?: string): string; getNestedSitemapPath(): string; resolveFilePath(relativePath: string): string; readJsonFile(relativePath: string): any | null; readJsonFileAbsolute(absolutePath: string): any | null; readJsonFilesFromFolder(folderName: string, fileExtension?: string): any[]; listFilesInFolder(folderName: string, fileExtension?: string): string[]; readTempFile(fileName: string): string; createTempFile(fileName: string, content: string): string; renameFile(oldFile: string, newFile: string): void; readDirectory(folderName: string, baseFolder?: string): string[]; folderExists(folderName: string, baseFolder?: string): boolean; codeFileExists(): boolean; deleteCodeFile(): boolean; fileExists(path: string): boolean; cleanup(path: string): void; cliFolderExists(): boolean; finalizeLogFile(operationType: 'pull' | 'push' | 'sync'): string; }