This commit is contained in:
2024-09-09 04:28:10 +09:00
parent a0c9bbfe9a
commit d5e23f5033
8 changed files with 1475 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import fs from 'fs';
import { Entry } from './entry.ts';
export function writeConfig(entries: Entry[]) {
const data = JSON.stringify(entries, null, 2);
fs.writeFile('./config.json', data, (err) => {
if (err) {
console.error(err);
return;
}
});
}
export function readConfig(): Entry[] {
if (!fs.existsSync('./config.json')) {
return [];
}
const data = fs.readFileSync('./config.json', 'utf8');
return JSON.parse(data);
}