修复脚本管理数据

This commit is contained in:
whyour
2021-11-12 23:18:24 +08:00
parent c3eb845be4
commit f14a3fe0f1
4 changed files with 67 additions and 54 deletions
+1 -11
View File
@@ -2,6 +2,7 @@ import DataStore from 'nedb';
import config from '../config';
import Logger from './logger';
import fs from 'fs';
import { fileExist } from '../config/util';
interface Dbs {
cronDb: DataStore;
@@ -13,17 +14,6 @@ interface Dbs {
const db: Dbs = {} as any;
async function fileExist(file: any) {
return new Promise((resolve) => {
try {
fs.accessSync(file);
resolve(true);
} catch (error) {
resolve(false);
}
});
}
async function truncateDb() {
return new Promise(async (resolve) => {
const files = [