mirror of
https://github.com/pawelmalak/flame.git
synced 2026-02-28 09:23:12 +08:00
Read/write css file from app settings. Changed order of operations at app startup. Added nano to Dockerfile
This commit is contained in:
25
utils/File.js
Normal file
25
utils/File.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const fs = require('fs');
|
||||
|
||||
class File {
|
||||
constructor(path) {
|
||||
this.path = path;
|
||||
this.content = '';
|
||||
}
|
||||
|
||||
read() {
|
||||
try {
|
||||
const content = fs.readFileSync(this.path, { encoding: 'utf-8' });
|
||||
this.content = content;
|
||||
return this.content;
|
||||
} catch (err) {
|
||||
return err.message;
|
||||
}
|
||||
}
|
||||
|
||||
write(data) {
|
||||
this.content = data;
|
||||
fs.writeFileSync(this.path, this.content);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = File;
|
||||
Reference in New Issue
Block a user