t-comm
Version:
专业、稳定、纯粹的工具库
28 lines (27 loc) • 743 B
TypeScript
/**
* 写入文件
* @param {string} file 文件地址
* @param {any} data 文件数据
* @param {boolean} [isJson] 是否需要 json 序列化
* @example
* ```ts
* writeFileSync('a', 'b.txt', false);
*
* writeFileSync({ a: 1 }, 'b.json', true);
* ```
*/
export declare function writeFileSync(file: string, data: any, isJson?: boolean): void;
/**
* 读取文件
* @param {string} file 文件地址
* @param {boolean} [isJson] 是否需要 json 反序列化
* @returns {any} 文件内容
* @example
* ```ts
* readFileSync('b.txt', false);
*
* readFileSync('b.json', true);
* ```
*/
export declare function readFileSync(file: string, isJson?: boolean): any;
export declare function isDirectory(filePath?: string): boolean;