///
///
import { ILambdaConfig } from '../types';
interface IFileServiceConstructorConfig {
cwd?: string;
fs?: any;
sysinfo?: any;
dirname?: string;
}
export declare class FileService {
private cwd;
private fs;
private sysinfo;
private dirname;
constructor({ cwd, fs, sysinfo, dirname, }?: IFileServiceConstructorConfig);
copy(sourcePath: string, destinationPath: string): void | Error;
directoryOrFileExists(pathToFile: string): boolean | Error;
/**
* Returns the path to a functions folder or a file inside a function folder
* @param {string} functionsName
* @param {string} [fileName]
* @returns {string} - path to function or file
* @memberof FileService
*/
getPathToFunction(functionsName: string, fileName?: string): string;
/**
* Returns the path to the settings.json
* @returns {string} - path to settings.json
* @memberof FileService
*/
getPathToSettings(): string;
/**
* Reads a the content of a file
* @param {string} pathToFile - path to file
* @param {boolean} [parseJSON=true] - should the output be parsed as JSON
* @param {string} [encoding='utf8'] - encoding of the file
* @returns {*} - content of a file
* @memberof FileService
*/
read(pathToFile: string, parseJSON?: boolean, encoding?: string): any;
/**
* Returns all function directories
* @returns {string[]} - Array of function folders
* @memberof FileService
*/
getFunctionsDirectories(): string[];
/**
* Write content to a file
* @param {string} pathToWriteFile - path to the file
* @param {*} data - content of the file
* @param {boolean} [stringify=true] - should the content be stringified
* @param {string} [encoding='utf8'] - encoding of the file
* @returns {void}
* @memberof FileService
*/
write(pathToWriteFile: string, data: any, stringify?: boolean, encoding?: string): void;
/**
* Returns the decrypted temp file.
* @returns {Promise} - returns the decrypted temp file
* @memberof FileService
*/
getTempFile(): Promise;
/**
* Writes the temp file to the temp directory of the os.
* (Temp directory of the OS gets cleared after restart)
* @param {*} data - temp file content
* @returns {Promise} - void
* @memberof FileService
*/
writeTempFile(data: any): Promise;
/**
* Deletes the temp file from the os temp directory
* @memberof FileService
*/
deleteTempFile(): void;
/**
* Returns the function config (config.json) of the passed function.
* @param {string} functionName - function name
* @returns {*} - config
* @memberof FileService
*/
getFunctionConfig(functionName: string): ILambdaConfig;
/**
* Returns config files for multiple passed functions.
* @param {string[]} [lambdaFunctions] - lambda functions
* @returns {ILambdaConfig[]} - Lambda configs
* @memberof FileService
*/
collectLocalLambdaInformation(lambdaFunctions?: string[]): ILambdaConfig[];
/**
* Returns the name of the function folder.
* Needed if the user calls a command inside a function folder.
* @returns {string} - function folder name
* @memberof FileService
*/
getFunctionFolderName(): string;
/**
* Returns the path to the root directory
* @returns {string} - root directory
* @memberof FileService
*/
getRoot(): string;
needUpdateBinFolder(): boolean;
/**
* Return the config for crypto.
* Takes the uuid of the system as password for pseudo encryption.
* @returns {Promise<{ algorithm: string; key: Buffer; iv: string }>}
*/
getCryptoConfig(): Promise<{
algorithm: string;
key: Buffer;
iv: string;
}>;
private encrypt;
private decrypt;
}
export {};