@srob/files
Version:
Helpers to programmatically edit text files, save, diff, folder-diff, etc.
21 lines (20 loc) • 544 B
TypeScript
export class File {
/**
* @type string|null
*/
path: string | null;
/**
* @type string|null
*/
content: string | null;
/**
* Writes the new file content on disk
* @param {string|null} path If set, the file will be saved at the given path (for this time only)
*/
save(path?: string | null): Promise<void>;
/**
* Writes the new file content in a temporary folder, runs a diff command and returns the diff
* @returns {Promise<string>}
*/
diff(): Promise<string>;
}