import { exists, readFile, remove } from "fs-promise"; import { writeFile } from "mz/fs"; import { IFile } from "./interfaces"; /** * */ export class FileService { /** * * @param file */ public async exists(file: IFile): Promise { return await exists(file.path); } public async read(file: IFile, encoding: string = "UTF-8"): Promise { return await readFile(file.path, {encoding}); } public async write(file: IFile, data: string, encoding?: string) { await writeFile(file.path, data, encoding); } public async remove(file: IFile) { return await remove(file.path); } }