INNER CODE UNIT · TypeScript
File
dtinth/todo-actions · src/File.ts:3
export class File implements IFile {
fileName: string
contents: FileContents
constructor(fileName: string) {
this.fileName = fileName
this.contents = new FileContents(
require('fs').readFileSync(fileName, 'utf8'),
)
}
save() {
if (this.contents.changed) {
require('fs').writeFileSync(
this.fileName,
this.contents.toString(),
'utf8',
)