export interface FileServiceOptions { /** * 默认数据 */ defaultData?: T; /** * 覆盖现有数据 */ overwrite?: boolean; /** * 是否开启文件变更监测 */ watch?: boolean; /** * 监测到文件变化后的回调 */ onChange?: () => void; } export default class FileService = {}> { fileName: string; filePath: string; options: FileServiceOptions; constructor(filePath: string, options?: FileServiceOptions); /** * 读取文件 */ read(): T; /** * 写入文件 */ write(data: T): void; /** * 移除文件 */ remove(): void; private _watch; private _init; }